Class Truncate

Inheritance Relationships

Base Type

Class Documentation

class Truncate : public mindspore::dataset::TensorTransform

Truncate the input sequence so that it does not exceed the maximum length.

Public Functions

explicit Truncate(int32_t max_seq_len)

Constructor.

Parameters

max_seq_len[in] Maximum allowable length.

Example
/* Define operations */
auto truncate_op = text::Truncate(5);

/* dataset is an instance of Dataset object */
dataset = dataset->Map({truncate_op},   // operations
                       {"text"});       // input columns
~Truncate() override = default

Destructor.