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, double smoothing_rate = 0.0)

Constructor.

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

Parameters
  • num_classes[in] number of classes.

  • smoothing_rate[in] smoothing rate default(0.0).

~OneHot() = default

Destructor.