Skip to content

Commit 83cd3fd

Browse files
author
Dandelion Mané
authored
Merge pull request tensorflow#8106 from Jiaming-Liu/patch-1
Fix a bug of initializing
2 parents 99e30bc + 6488dd4 commit 83cd3fd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tensorflow/python/ops/variable_scope.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,9 @@ def _get_single_variable(self,
683683
init_val = initializer
684684
variable_dtype = None
685685
else:
686+
# Instantiate initializer if provided initializer is a type object.
687+
if isinstance(initializer, type(init_ops.Initializer)):
688+
initializer=initializer(dtype=dtype)
686689
init_val = lambda: initializer( # pylint: disable=g-long-lambda
687690
shape.as_list(), dtype=dtype, partition_info=partition_info)
688691
variable_dtype = dtype.base_dtype

0 commit comments

Comments
 (0)