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

Function cast

tensorflow/contrib/labeled_tensor/python/ops/ops.py:1172–1186  ·  view source on GitHub ↗

Casts a labeled tensor to a new type. Args: labeled_tensor: The input tensor. dtype: The type of the returned tensor. name: Optional op name. Returns: A labeled tensor with the new dtype.

(labeled_tensor, dtype=None, name=None)

Source from the content-addressed store, hash-verified

1170@tc.accepts(core.LabeledTensorLike,
1171 tc.Optional(dtypes.DType), tc.Optional(string_types))
1172def cast(labeled_tensor, dtype=None, name=None):
1173 """Casts a labeled tensor to a new type.
1174
1175 Args:
1176 labeled_tensor: The input tensor.
1177 dtype: The type of the returned tensor.
1178 name: Optional op name.
1179
1180 Returns:
1181 A labeled tensor with the new dtype.
1182 """
1183 with ops.name_scope(name, 'lt_cast', [labeled_tensor]) as scope:
1184 labeled_tensor = core.convert_to_labeled_tensor(labeled_tensor)
1185 op = math_ops.cast(labeled_tensor.tensor, dtype=dtype, name=scope)
1186 return core.LabeledTensor(op, labeled_tensor.axes)
1187
1188
1189@tc.returns(core.LabeledTensor)

Callers 4

LiteralToPythonFunction · 0.50
castMethod · 0.50
TestAllOpsMethod · 0.50
ComputeAsyncMethod · 0.50

Calls 2

name_scopeMethod · 0.45
castMethod · 0.45

Tested by 1

TestAllOpsMethod · 0.40