aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/layers
diff options
context:
space:
mode:
authorGravatar Alexandre Passos <apassos@google.com>2018-08-20 10:51:46 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-20 10:55:11 -0700
commit88d3a0609be831561214911481bc5d73b3ceca53 (patch)
treeb1daddde22e90913b0cdcb94be4c3b5352a18760 /tensorflow/python/layers
parenta5ba38b40215ee68aa34b19204e182162bfcb04d (diff)
initializer might be a tensor so do not try to convert it to a boolean
PiperOrigin-RevId: 209446309
Diffstat (limited to 'tensorflow/python/layers')
-rw-r--r--tensorflow/python/layers/base.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tensorflow/python/layers/base.py b/tensorflow/python/layers/base.py
index ab08865532..3ba880d7a1 100644
--- a/tensorflow/python/layers/base.py
+++ b/tensorflow/python/layers/base.py
@@ -262,11 +262,13 @@ class Layer(base_layer.Layer):
use_resource = (use_resource or
self._use_resource_variables or
scope.use_resource)
+ if initializer is None:
+ initializer = scope.initializer
variable = super(Layer, self).add_weight(
name,
shape,
dtype=dtypes.as_dtype(dtype),
- initializer=initializer or scope.initializer,
+ initializer=initializer,
trainable=trainable,
constraint=constraint,
partitioner=partitioner,