MCPcopy Create free account
hub / github.com/apache/singa / cast

Function cast

python/singa/autograd.py:4713–4724  ·  view source on GitHub ↗

The operator casts the elements of a given input tensor to a data type specified by the 'to' argument and returns an output tensor of the same size in the converted type. Args: x (Tensor): input tensor. to (int): data type, float32 = 0; int = 2. Returns:

(x, to)

Source from the content-addressed store, hash-verified

4711
4712
4713def cast(x, to):
4714 """
4715 The operator casts the elements of a given input tensor to a data type
4716 specified by the 'to' argument and returns an output tensor of the same
4717 size in the converted type.
4718 Args:
4719 x (Tensor): input tensor.
4720 to (int): data type, float32 = 0; int = 2.
4721 Returns:
4722 the output Tensor.
4723 """
4724 return Cast(to)(x)[0]
4725
4726
4727class OneHot(Operator):

Callers 1

half_castFunction · 0.85

Calls 1

CastClass · 0.85

Tested by

no test coverage detected