97 Base::operator=(_ref);
119 int size(
int dim)
const {
return size_.
at(dim); }
132 Base::operator=(_tensor._ref);
133 size_ = _tensor.size_;
144 for (
int dim = 0; dim <
Rank; ++dim) {
145 if (coord.
at(dim) >= size_.
at(dim)) {
CUTLASS_HOST_DEVICE TensorRef_t const & ref() const
Accesses the tensor reference pointing to data.
Definition: tensor_view.h:111
Defines a structure containing strides, bounds, and a pointer to tensor data.
CUTLASS_HOST_DEVICE Storage & at(Coord< Rank > const &coord) const
Returns a reference to the element at a given Coord.
Definition: tensor_ref.h:121
int Offset_t
Type used to compute the offset of an element to the base of a tensor.
Definition: tensor_view.h:57
static int const Rank
Rank of tensor.
Definition: tensor_ref.h:48
CUTLASS_HOST_DEVICE TensorView()
Default constructor.
Definition: tensor_view.h:80
CUTLASS_HOST_DEVICE int size(int dim) const
Accesses the size.
Definition: tensor_view.h:119
CUTLASS_HOST_DEVICE Coord & clamp(Coord< N > const &max, Coord< N > const &min=Coord< N >())
Clamps a coordinate to a range specified by maximum and minimum values.
Definition: coord.h:219
Coord< Rank > Coord_t
Coordinate into tensor.
Definition: tensor_view.h:60
CUTLASS_HOST_DEVICE void reset(TensorRef_t const &_ref=TensorRef_t(0), Coord_t const &_size=Coord_t())
Updates the reference and size of a Tensor_view object.
Definition: tensor_view.h:96
CUTLASS_HOST_DEVICE bool contains(Coord_t const &coord) const
Determines whether a location is within a tensor.
Definition: tensor_view.h:143
CUTLASS_HOST_DEVICE int const & stride(int dim) const
Accesses the stride.
Definition: tensor_view.h:127
static int const Rank
Rank of tensor.
Definition: tensor_view.h:54
CUTLASS_HOST_DEVICE T & at(Offset_t idx) const
Element-wise accessor.
Definition: tensor_view.h:161
CUTLASS_HOST_DEVICE ConstTensorRef_t const_ref()
Definition: tensor_view.h:107
CUTLASS_HOST_DEVICE Storage * data() const
Returns the pointer to referenced data.
Definition: tensor_ref.h:99
Host-side reference implementation of tensor operations.
Definition: tensor_view.h:42
CUTLASS_HOST_DEVICE long long offset(Coord< Rank > const &coord) const
Computes the offset of an index from the origin of the tensor.
Definition: tensor_ref.h:115
Structure modeling a pointer and stride into a tensor.
Definition: tensor_ref.h:42
TensorRef< T, 4 > Base
Reference and stride.
Definition: tensor_view.h:45
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:46
CUTLASS_HOST_DEVICE bool good() const
Returns true if the Tensor_view is bound to some memory.
Definition: tensor_view.h:88
CUTLASS_HOST_DEVICE bool good() const
Returns true if the TensorRef may be safely accessed.
Definition: tensor_ref.h:95
CUTLASS_HOST_DEVICE Offset_t offset(Coord_t const &coord) const
Returns the index of an element.
Definition: tensor_view.h:139
CUTLASS_HOST_DEVICE T * data() const
Returns a pointer to data.
Definition: tensor_view.h:92
T & operator[](Coord< Rank > const &coord) const
Element-wise accessor.
Definition: tensor_view.h:157
Base TensorRef_t
Reference and stride.
Definition: tensor_view.h:48
CUTLASS_HOST_DEVICE int & at()
Gets the index of a given Coord element.
Definition: coord.h:185
CUTLASS_HOST_DEVICE T & at(Coord_t const &coord) const
Element-wise accessor.
Definition: tensor_view.h:154
CUTLASS_HOST_DEVICE Coord_t const & size() const
Accesses the size.
Definition: tensor_view.h:115
CUTLASS_HOST_DEVICE Coord_t const & stride() const
Accesses the stride.
Definition: tensor_view.h:123
CUTLASS_HOST_DEVICE TensorRef_t & ref()
Accesses the tensor reference pointing to data.
Definition: tensor_view.h:103
CUTLASS_HOST_DEVICE Coord< Rank > const & stride() const
Returns the stride of the tensor.
Definition: tensor_ref.h:103
CUTLASS_HOST_DEVICE TensorView & operator=(TensorView const &_tensor)
Assigns the Tensor_view.
Definition: tensor_view.h:131
Basic include for CUTLASS macros.
CUTLASS_HOST_DEVICE TensorView(TensorRef_t const &_ref, Coord_t const &_size)
Constructs a Tensor_view from a TensorRef and size.
Definition: tensor_view.h:84
TensorRef< T const, 4 > ConstTensorRef_t
Reference to constant type.
Definition: tensor_view.h:51
CUTLASS_HOST_DEVICE TensorView< T > subview(Coord_t const &location, Coord_t size) const
Returns a Tensor_view given location and size quantities.
Definition: tensor_view.h:165