MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / from_tensor

Method from_tensor

tensorpack/compat/tensor_spec.py:52–58  ·  view source on GitHub ↗
(cls, tensor, name=None)

Source from the content-addressed store, hash-verified

50
51 @classmethod
52 def from_tensor(cls, tensor, name=None):
53 if isinstance(tensor, ops.EagerTensor):
54 return TensorSpec(tensor.shape, tensor.dtype, name)
55 elif isinstance(tensor, ops.Tensor):
56 return TensorSpec(tensor.shape, tensor.dtype, name or tensor.op.name)
57 else:
58 raise ValueError("`tensor` should be a tf.Tensor")
59
60 @property
61 def shape(self):

Callers

nothing calls this directly

Calls 1

TensorSpecClass · 0.85

Tested by

no test coverage detected