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

Function _AsTensorList

tensorflow/python/ops/control_flow_ops.py:2763–2790  ·  view source on GitHub ↗

Return x as a list of Tensors or IndexedSlices. For entries of `x` that are Operations, this returns an Identity of `p` with a dependency on the operation. Args: x: A Tensor/IndexedSlices/Operation or a list or tuple of them. p: A Tensor to return for entries in `x` that are Operatio

(x, p)

Source from the content-addressed store, hash-verified

2761
2762
2763def _AsTensorList(x, p):
2764 """Return x as a list of Tensors or IndexedSlices.
2765
2766 For entries of `x` that are Operations, this returns an Identity of `p`
2767 with a dependency on the operation.
2768
2769 Args:
2770 x: A Tensor/IndexedSlices/Operation or a list or tuple of them.
2771 p: A Tensor to return for entries in `x` that are Operations.
2772
2773 Returns:
2774 A list of Tensors or IndexedSlices.
2775 """
2776 if not isinstance(x, (list, _basetuple)):
2777 x = [x]
2778
2779 l = []
2780 for v in x:
2781 if isinstance(v, ops.Operation):
2782 v = with_dependencies([v], p)
2783 v = ops.convert_to_tensor_or_composite(v)
2784 if isinstance(v, ops.Tensor):
2785 l.append(array_ops.identity(v))
2786 else:
2787 l.append(
2788 ops.IndexedSlices(
2789 array_ops.identity(v.values), array_ops.identity(v.indices)))
2790 return l
2791
2792
2793def _CheckResults(a, b):

Callers

nothing calls this directly

Calls 3

with_dependenciesFunction · 0.85
appendMethod · 0.45
identityMethod · 0.45

Tested by

no test coverage detected