Merge pull request #47266 from behzad-a:custom_gradient_determinism

PiperOrigin-RevId: 359045327
Change-Id: Ibfcac7635f8d79f06ff89eac796d5ef9aeeca25a
This commit is contained in:
TensorFlower Gardener 2021-02-23 07:55:56 -08:00
commit 33c163c589

View File

@ -373,8 +373,9 @@ def _graph_mode_decorator(f, args, kwargs):
v.ref() for v in _get_dependent_variables(
input_ops=filtered_input_tensors, output_ops=flat_result)
])
variables = list(
[v.deref() for v in variables_in_subgraph.union(variables_in_tape)])
variables = sorted(
[v.deref() for v in variables_in_subgraph.union(variables_in_tape)],
key=lambda v: v.name)
grad_argspec = tf_inspect.getfullargspec(grad_fn)
variables_in_signature = ("variables" in grad_argspec.args or