vt::TensorSliceProxy#

struct EllipsisT#

Represents an ellipsis in tensor operations.

The EllipsisT struct is used to signify an ellipsis in tensor slicing operations. A global static object of this type, named ellipsis, is defined for convenience.

struct NewAxisT#

Represents an newaxis in tensor operations.

The NewAxisT struct is used to signify a new axis in tensor operations. A global static object of this type, named newaxis, is defined for convenience.

class Slice#

Slice class to represent a slice of a tensor. Usage: Slice(0) -> Slice from 0 to 1 with step 1 Slice(0, 10) -> Slice from 0 to 10 with step 1 Slice(0, 10, 2) -> Slice from 0 to 10 with step 2.

Public Functions

inline Slice(size_t start)#

Construct a new Slice object.

Parameters:

start – The start index of the slice.

inline Slice(size_t start, size_t end)#

Construct a new Slice object.

Parameters:
  • start – The start index of the slice.

  • end – The end index of the slice.

inline Slice(size_t start, size_t end, size_t step)#

Construct a new Slice object.

Parameters:
  • start – The start index of the slice.

  • end – The end index of the slice.

  • step – The step of the slice.

template<typename T, size_t N>
class TensorSliceProxy : public vt::Tensor<T, N>#

TensorSliceProxy to perform a copy assignment operation for a sliced tensor.

It helps to distingush between the Tensor copy assignment operator with TensorSliceProxy copy assignment operator. tensor1 = tensor2; -> Tensor copy assignment operator, the content in tensor1 will be overwritten by tensor2. tensor1(Slice(0, 2)) = tensor2; -> TensorSliceProxy copy assignment operator, the content in tensor1 would not be overwritten by tensor2.

Template Parameters:
  • T – Data type of the tensor.

  • N – Number of dimensions of the tensor.

Public Functions

inline TensorSliceProxy(const Tensor<T, N> &tensor)#

Construct a TensorSliceProxy object.

Parameters:

tensor – The sliced tensor.

inline TensorSliceProxy &operator=(const Tensor<T, N> &other)#

Copy assignment operator for TensorSliceProxy from other TensorSliceProxy.

Parameters:

other – The TensorSliceProxy to be copied.

Returns:

TensorSliceProxy: The tensor slice proxy object.

inline TensorSliceProxy &operator=(const TensorSliceProxy<T, N> &other)#

Copy assignment operator for TensorSliceProxy from other TensorSliceProxy.

Parameters:

other – The TensorSliceProxy to be copied.

Returns:

TensorSliceProxy: The tensor slice proxy object.

inline TensorSliceProxy &operator=(const T value)#

Copy assignment operator for TensorSliceProxy from a constant.

Parameters:

other – The value to be copied.

Returns:

TensorSliceProxy: The tensor slice proxy object.