Class SlidingWindow

Inheritance Relationships

Base Type

Class Documentation

class SlidingWindow : public mindspore::dataset::TensorTransform

Construct a tensor from data (only 1-D for now), where each element in the dimension axis is a slice of data starting at the corresponding position, with a specified width.

Public Functions

explicit SlidingWindow(int32_t width, int32_t axis = 0)

Constructor.

Parameters
  • width[in] The width of the window. It must be an integer and greater than zero.

  • axis[in] The axis where the sliding window is computed (default=0), axis only supports 0 or -1 for now.

Example
/* Define operations */
auto slidingwindow_op = text::SlidingWindow(5, 0);

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

Destructor.