Class Slice

Class Documentation

class mgb::Slice

slice along some axis; index as in Python, with negative indices supported

Public Functions

Slice(Maybe<ptrdiff_t> begin = None, Maybe<ptrdiff_t> end = None, Maybe<ptrdiff_t> step = None)
SubTensorSpec apply(TensorLayout layout, int axis) const

apply this slice on given tensor layout, and get corresponding subtensor

  • axis: the axis to apply this slice; -1 can be used for flattened layout