pytaco.as_type
- pytaco.as_type(t, type)
Converts a tensor from one type to another.
- Parameters
- t: tensor
Tensor to convert
- type:class:dtype
The data type of the new tensor
- Returns
- new_t: tensor
A new tensor new_t with datatype type where all elements in t are cast to type.
Examples
>>> import pytaco as pt >>> t = pt.tensor(100, dtype=pt.double) >>> pt.as_type(t, pt.int8).dtype pytaco.int8_t