MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _TensorConversionFunction

Method _TensorConversionFunction

tensorflow/python/ops/variables.py:1241–1251  ·  view source on GitHub ↗

Utility function for converting a Variable to a Tensor.

(v, dtype=None, name=None, as_ref=False)

Source from the content-addressed store, hash-verified

1239 # Conversion to tensor.
1240 @staticmethod
1241 def _TensorConversionFunction(v, dtype=None, name=None, as_ref=False): # pylint: disable=invalid-name
1242 """Utility function for converting a Variable to a Tensor."""
1243 _ = name
1244 if dtype and not dtype.is_compatible_with(v.dtype):
1245 raise ValueError(
1246 "Incompatible type conversion requested to type '%s' for variable "
1247 "of type '%s'" % (dtype.name, v.dtype.name))
1248 if as_ref:
1249 return v._ref() # pylint: disable=protected-access
1250 else:
1251 return v.value()
1252
1253 @classmethod
1254 def _OverloadAllOperators(cls): # pylint: disable=invalid-name

Callers

nothing calls this directly

Calls 3

is_compatible_withMethod · 0.45
_refMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected