Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TensorFlow follow some of its own deprecation warnings #27964

Merged
merged 3 commits into from Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions tensorflow/python/framework/func_graph.py
Expand Up @@ -370,7 +370,6 @@ def _capture_by_value(
name=None,
attrs=None,
op_def=None,
compute_shapes=True,
compute_device=True):
# When capturing by value, do the read outside
reverse_captures = dict((v, k) for k, v in self.captures.items())
Expand All @@ -384,7 +383,7 @@ def _capture_by_value(
else:
op = ops.get_default_graph().create_op(
op_type, uncaptured_inputs, dtypes, input_types, name, attrs,
op_def, compute_shapes, compute_device)
op_def, compute_device=compute_device)
value = op.outputs[0]
captured_value = self.capture(value)
return captured_value.op
Expand Down Expand Up @@ -432,11 +431,12 @@ def create_op(
Returns:
An `Operation` object.
"""
del compute_shapes
if self.capture_by_value and op_type in ["ReadVariableOp",
"ResourceGather"]:
return self._capture_by_value(
op_type, inputs, dtypes, input_types, name, attrs, op_def,
compute_shapes, compute_device)
compute_device)

# This capturing logic interacts poorly with control flow contexts which
# want to replace inputs of ops far too late in the process. This can lead
Expand Down
3 changes: 1 addition & 2 deletions tensorflow/python/framework/function.py
Expand Up @@ -1019,8 +1019,7 @@ def _call(sig, *inputs, **kwargs):
output_types,
name=name,
attrs=attrs,
op_def=sig,
compute_shapes=False)
op_def=sig)
if op.outputs:
if len(op.outputs) == 1:
ret = op.outputs[0]
Expand Down
1 change: 0 additions & 1 deletion tensorflow/python/ops/functional_ops.py
Expand Up @@ -853,7 +853,6 @@ def partitioned_call(args, f, tout=None, executing_eagerly=None, config=None,
op_name,
args,
tout,
compute_shapes=False,
name="PartitionedFunctionCall",
attrs={
"Tin": tin_attr,
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/python/ops/variable_scope.py
Expand Up @@ -893,7 +893,7 @@ def _get_single_variable(self,
else:
# Instantiate initializer if provided initializer is a type object.
if tf_inspect.isclass(initializer):
initializer = initializer(dtype=dtype)
initializer = initializer()
if shape is not None and shape.is_fully_defined():
init_val = lambda: initializer( # pylint: disable=g-long-lambda
shape.as_list(),
Expand Down
8 changes: 3 additions & 5 deletions tensorflow/python/training/moving_averages.py
Expand Up @@ -208,9 +208,7 @@ def _zero_debias(unbiased_var, value, decay):
decay]) as scope:
with ops.colocate_with(unbiased_var):
with ops.init_scope():
biased_initializer = init_ops.zeros_initializer(
dtype=unbiased_var.dtype)(
unbiased_var.get_shape())
biased_initializer = init_ops.zeros_initializer()
local_step_initializer = init_ops.zeros_initializer()

def _maybe_get_unique(name):
Expand All @@ -230,8 +228,8 @@ def _maybe_get_unique(name):
return name + ("_%d" % idx)

biased_var = variable_scope.get_variable(
_maybe_get_unique("biased"),
initializer=biased_initializer,
_maybe_get_unique("biased"), initializer=biased_initializer,
shape=unbiased_var.get_shape(), dtype=unbiased_var.dtype,
trainable=False)
local_step = variable_scope.get_variable(
_maybe_get_unique("local_step"),
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/python/training/slot_creator.py
Expand Up @@ -184,7 +184,7 @@ def create_zeros_slot(primary, name, dtype=None, colocate_with_primary=True):
dtype = primary.dtype
slot_shape = primary.get_shape()
if slot_shape.is_fully_defined():
initializer = init_ops.zeros_initializer(dtype)
initializer = init_ops.zeros_initializer()
return create_slot_with_initializer(
primary, initializer, slot_shape, dtype, name,
colocate_with_primary=colocate_with_primary)
Expand Down