cast_to

Tensor.cast_to(tensor)

Converts tensor data to special data type.

Note

This method only supports tensor data stored on host.

Parameters:

tensor (Tensor) -- The Tensor object to cast to.

Example

import tcim_lite as tcim
# ...
# Create a tensor of target dtype
input_info = module.get_input_info(output_name).astype(np.float32)
output_data = tcim.runtime.Tensor(input_info)
# Get the module output data, and convert data to float32
module.get_output(output_name).cast_to(output_data)