Utility function for converting a Variable to a Tensor.
(v, dtype=None, name=None, as_ref=False)
| 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 |
nothing calls this directly
no test coverage detected