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.

参数

max_seq_len[in] Maximum allowable length.

样例
/* 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() = default

Destructor.