Class Slice

Inheritance Relationships

Base Type

Class Documentation

class Slice : public mindspore::dataset::TensorTransform

Extract a tensor out using the given n slices. The functionality of Slice is similar to the feature of indexing of NumPy. (Currently only rank-1 tensors are supported).

Public Functions

explicit Slice(const std::vector<SliceOption> &slice_input)

Constructor.

Parameters

slice_input[in] Vector of SliceOption.

样例
/* Define operations */
SliceOption slice_option = SliceOption(Slice(0, 3, 2));
transforms::Slice slice_op = transforms::Slice({slice_option});

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

Destructor.