TensorView

template<ScalarType T, int _dim>
class TensorView

Typed, dimension-checked view onto a Tensor’s data.

Indexing with operator[] or get peels off leading dimensions until _dim reaches 0, at which point the view converts to and from a single element of type T.

Public Types

using DType = T

Public Functions

inline TensorView(T *data, std::size_t *stride, std::size_t *shape)
inline TensorView(PackedTensorView<T, _dim> &packed_view)
inline TensorView(T &value)
inline const TensorView<T, _dim - 1> operator[](std::size_t index) const
inline TensorView<T, _dim - 1> operator[](std::size_t index)
template<typename ...I>
inline const TensorView<T, _dim - sizeof...(I)> get(I... index) const
template<typename ...I>
inline TensorView<T, _dim - sizeof...(I)> get(I... index)
inline operator T() const
inline T operator=(T value)
inline T operator+=(T value)
TensorView<T, _dim> &operator=(TensorView<T, _dim> &value) = delete
inline std::size_t size(std::size_t index = 0) const
inline T *data() const
inline std::size_t *stride() const
inline std::size_t *shape() const
inline T gather(me_int_t index) const
inline void scatter_add(me_int_t index, T value)

Public Static Attributes

static const int dim
static constexpr bool is_scalar_view