aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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