From 655c52b014df4a9b7dc8212aabb0bdf20da44107 Mon Sep 17 00:00:00 2001 From: Akshay Modi Date: Fri, 15 Jun 2018 10:23:23 -0700 Subject: Minor python change to remove doing unnecessary work in resource variables PiperOrigin-RevId: 200735157 --- tensorflow/python/ops/resource_variable_ops.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/ops/resource_variable_ops.py b/tensorflow/python/ops/resource_variable_ops.py index de44a3e848..2033674a92 100644 --- a/tensorflow/python/ops/resource_variable_ops.py +++ b/tensorflow/python/ops/resource_variable_ops.py @@ -851,14 +851,15 @@ class ResourceVariable(variables.Variable): operator: string. The operator name. """ + tensor_oper = getattr(ops.Tensor, operator) def _run_op(a, *args): # pylint: disable=protected-access value = a._AsTensor() - return getattr(ops.Tensor, operator)(value, *args) + return tensor_oper(value, *args) # Propagate __doc__ to wrapper try: - _run_op.__doc__ = getattr(ops.Tensor, operator).__doc__ + _run_op.__doc__ = tensor_oper.__doc__ except AttributeError: pass -- cgit v1.2.3