aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Akshay Modi <nareshmodi@google.com>2018-06-15 10:23:23 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-15 10:26:05 -0700
commit655c52b014df4a9b7dc8212aabb0bdf20da44107 (patch)
tree81ae8aeca76fb8a9bbaff572aa2b319e16d75ded
parent8ad3184c7af54cad42a15afb3e83436bd195d17f (diff)
Minor python change to remove doing unnecessary work in resource variables
PiperOrigin-RevId: 200735157
-rw-r--r--tensorflow/python/ops/resource_variable_ops.py5
1 files 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