Class OneHot

Inheritance Relationships

Base Type

Class Documentation

class OneHot : public mindspore::dataset::TensorTransform

Convert the labels into OneHot format.

Public Functions

explicit OneHot(int32_t num_classes)

Constructor.

Parameters

num_classes[in] number of classes.

Example
/* Define operations */
mindspore::MSTensor constant;
auto one_hot_op = transforms::OneHot(10);

/* dataset is an instance of Dataset object */
dataset = dataset->Map({one_hot_op},    // operations
                       {"column"});     // input columns
~OneHot() = default

Destructor.