Class ToTensor

Inheritance Relationships

Base Type

Class Documentation

class ToTensor : public mindspore::dataset::TensorTransform

Divide the pixel values by 255 and convert from HWC format to CHW format with required datatype.

Public Functions

ToTensor()

Constructor.

Example
/* Define operations */
auto to_tensor_op = vision::ToTensor();

/* dataset is an instance of Dataset object */
dataset = dataset->Map({to_tensor_op},  // operations
                       {"image"});  // input columns

Parameters

output_type[in] The type of the output tensor of type mindspore::DataType or String (default=mindspore::DataType::kNumberTypeFloat32).

~ToTensor() = default

Destructor.