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

Method convert

tensorflow/python/ops/parallel_for/pfor.py:1215–1239  ·  view source on GitHub ↗

Returns the converted value corresponding to y. Args: y: A ops.Tensor or a ops.Operation object. If latter, y should not have any outputs. Returns: If y does not need to be converted, it returns y as is. Else it returns the "converted value" corresponding to y.

(self, y)

Source from the content-addressed store, hash-verified

1213 return _stack(output, self._loop_len_vector).t
1214
1215 def convert(self, y):
1216 """Returns the converted value corresponding to y.
1217
1218 Args:
1219 y: A ops.Tensor or a ops.Operation object. If latter, y should not have
1220 any outputs.
1221
1222 Returns:
1223 If y does not need to be converted, it returns y as is. Else it returns
1224 the "converted value" corresponding to y.
1225 """
1226 if y is None:
1227 return None
1228 if isinstance(y, sparse_tensor.SparseTensor):
1229 return self._convert_sparse(y)
1230 assert isinstance(y, (ops.Tensor, ops.Operation)), y
1231 output = self._convert_helper(y)
1232 if isinstance(output, WrappedTensor):
1233 assert isinstance(y, ops.Tensor)
1234 return self._unwrap_or_tile(output)
1235 else:
1236 assert isinstance(y, ops.Operation)
1237 assert not y.outputs
1238 assert isinstance(output, ops.Operation)
1239 return output
1240
1241 def _was_converted(self, t):
1242 """True if t is not a conversion of itself."""

Callers 8

_pfor_implFunction · 0.95
true_fnMethod · 0.45
converted_callFunction · 0.45
to_graphFunction · 0.45
TestClassClass · 0.45
conversion_threadMethod · 0.45
node_to_graph_wrapperMethod · 0.45

Calls 3

_convert_sparseMethod · 0.95
_convert_helperMethod · 0.95
_unwrap_or_tileMethod · 0.95

Tested by 3

conversion_threadMethod · 0.36
node_to_graph_wrapperMethod · 0.36