aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tensorflow/python/keras/engine/network.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tensorflow/python/keras/engine/network.py b/tensorflow/python/keras/engine/network.py
index 5969fea2b2..266c48d304 100644
--- a/tensorflow/python/keras/engine/network.py
+++ b/tensorflow/python/keras/engine/network.py
@@ -432,6 +432,27 @@ class Network(base_layer.Layer):
'assign variables to attributes and they will show up in the weights '
'and variables properties.')
+ def add_weight(self,
+ name,
+ shape,
+ dtype=None,
+ initializer=None,
+ regularizer=None,
+ trainable=None,
+ constraint=None,
+ partitioner=None,
+ use_resource=None,
+ synchronization=variables.VariableSynchronization.AUTO,
+ aggregation=variables.VariableAggregation.NONE,
+ **kwargs):
+ if self._is_graph_network:
+ raise NotImplementedError('`add_weight` is not supported on Networks.')
+ else:
+ raise NotImplementedError(
+ '`add_weight` is not supported on Networks. However, you may '
+ 'assign variables to attributes and they will show up in the weights '
+ 'and variables properties.')
+
def add_loss(self, *args, **kwargs):
if context.executing_eagerly():
raise NotImplementedError('`add_loss` is not supported on Networks '