55 typename MapFunc_ = IdentityTensorMapFunc<Rank_>,
57 int StorageRank_ = MapFunc_::kStorageRank,
59 typename Index_ = int,
61 typename LongIndex_ =
long long 84 typedef typename Base::Index
Index;
113 static int const Rank = Base::kRank;
166 Base::operator=(_ref);
181 Base::operator=(_tensor);
182 size_ = _tensor.size_;
190 for (
int dim = 0; dim < Rank_; ++dim) {
191 if (coord[dim] >= size_[dim]) {
224 for (
int i = 0; i < Base::kStorageRank; ++i) {
226 this->
stride(i) * mapped_size[i] > this->
stride(max_rank) * mapped_size[max_rank]) {
230 return this->
stride(max_rank) * mapped_size[max_rank];
252 result.add_pointer_offset(-this->
offset(b));
Base::Index Index
Index type.
Definition: tensor_view.h:84
CUTLASS_HOST_DEVICE void reset(Base const &_ref=Base(), TensorCoord const &_size=TensorCoord())
Updates the reference and size of a Tensor_view object.
Definition: tensor_view.h:165
Defines a structure containing strides, bounds, and a pointer to tensor data.
CUTLASS_HOST_DEVICE TensorView(Storage *ptr, StorageCoord const &stride, TensorCoord const &size)
Constructs a TensorView from a pointer, a stride vector, and size.
Definition: tensor_view.h:156
TensorRef TensorRef_t
Base class.
Definition: tensor_view.h:119
CUTLASS_HOST_DEVICE Index size(int dim) const
Accesses the size.
Definition: tensor_view.h:176
Base::Storage Storage
Storage type.
Definition: tensor_view.h:81
Base TensorRef
Base tensor reference.
Definition: tensor_view.h:78
TensorView< typename platform::remove_const< Storage >::type const, Rank_, MapFunc_, StorageRank_, Index_, LongIndex_ > ConstTensorView
TensorView of constant value.
Definition: tensor_view.h:103
Storage_ Storage
Data type of individual access.
Definition: tensor_ref.h:134
CUTLASS_HOST_DEVICE StorageCoord stride() const
Returns the stride of the tensor.
Definition: tensor_ref.h:300
CUTLASS_HOST_DEVICE TensorCoord const & size() const
Accesses the size.
Definition: tensor_view.h:172
CUTLASS_HOST_DEVICE TensorRef & add_pointer_offset(LongIndex delta)
Adds an offset to each pointer.
Definition: tensor_ref.h:357
Index_ Index
Index type.
Definition: tensor_ref.h:146
TensorRef< typename platform::remove_const< Storage_ >::type const, Rank_, MapFunc_, StorageRank_, Index_, LongIndex_ > ConstTensorRef
Tensor reference to of constant value.
Definition: tensor_view.h:75
CUTLASS_HOST_DEVICE TensorView & operator-=(TensorCoord const &b)
Returns a TensorRef offset by a given amount.
Definition: tensor_view.h:258
CUTLASS_HOST_DEVICE StorageCoord map(TensorCoord const &coord) const
Maps a logical coordinate to an n-D array in memory.
Definition: tensor_ref.h:325
Defines a view into a logical tensor.
Definition: tensor_view.h:63
CUTLASS_HOST_DEVICE TensorView(Base const &_ref, TensorCoord const &_size)
Constructs a TensorView from a TensorRef and size.
Definition: tensor_view.h:143
TensorRef< Storage_, Rank_, MapFunc_, StorageRank_, Index_, LongIndex_ > Base
Base tensor reference.
Definition: tensor_view.h:66
Definition: tensor_ref.h:131
CUTLASS_HOST_DEVICE TensorView & operator=(TensorView const &_tensor)
Assigns the Tensor_view.
Definition: tensor_view.h:180
CUTLASS_HOST_DEVICE size_t capacity() const
Returns the number of scalar elements needed to store tensor.
Definition: tensor_view.h:218
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:46
CUTLASS_HOST_DEVICE Index & at()
Gets the index of a given Coord element.
Definition: coord.h:240
CUTLASS_HOST_DEVICE LongIndex offset(TensorCoord const &coord) const
Computes the offset of an index from the origin of the tensor.
Definition: tensor_ref.h:331
TensorRef::TensorCoord TensorCoord
Coordinate in logical tensor space.
Definition: tensor_view.h:87
Base::LongIndex Offset_t
Type used to compute the offset of an element to the base of a tensor.
Definition: tensor_view.h:116
TensorCoord Coord_t
Coordinate in logical tensor space.
Definition: tensor_view.h:110
CUTLASS_HOST_DEVICE TensorView subview(TensorCoord const &location, TensorCoord size) const
Returns a Tensor_view given location and size quantities.
Definition: tensor_view.h:212
CUTLASS_HOST_DEVICE TensorRef ref() const
Returns a TensorRef pointing to the first element of the tensor.
Definition: tensor_view.h:200
Statically-sized array specifying Coords within a tensor.
Definition: coord.h:49
static int const Rank
Logical rank of tensor index space.
Definition: tensor_view.h:113
CUTLASS_HOST_DEVICE TensorView & operator+=(TensorCoord const &b)
Returns a TensorRef offset by a given amount.
Definition: tensor_view.h:243
CUTLASS_HOST_DEVICE ConstTensorRef const_ref() const
Returns a TensorRef pointing to the first element of the tensor.
Definition: tensor_view.h:206
TensorRef::StrideVector StrideVector
Definition: tensor_view.h:94
CUTLASS_HOST_DEVICE TensorView operator-(TensorCoord const &b) const
Returns a TensorRef offset by a given amount.
Definition: tensor_view.h:250
CUTLASS_HOST_DEVICE TensorView()
Default constructor.
Definition: tensor_view.h:139
CUTLASS_HOST_DEVICE TensorView(Storage *ptr, StrideVector const &stride, TensorCoord const &size)
Constructs a TensorView from a pointer, a stride vector, and size.
Definition: tensor_view.h:147
CUTLASS_HOST_DEVICE Coord & clamp(Coord< kRank > const &max, Coord< kRank > const &min=Coord< kRank >())
Clamps a coordinate to a range specified by maximum and minimum values.
Definition: coord.h:274
CUTLASS_HOST_DEVICE TensorView operator+(TensorCoord const &b) const
Returns a TensorView offset by a given amount.
Definition: tensor_view.h:235
TensorRef::ConstTensorRef ConstTensorRef_t
TensorRef to const-valued type.
Definition: tensor_view.h:122
Basic include for CUTLASS macros.
TensorRef::StorageCoord StorageCoord
Coordinate in storage n-D array.
Definition: tensor_view.h:90
CUTLASS_HOST_DEVICE bool contains(TensorCoord const &coord) const
Determines whether a location is within a tensor.
Definition: tensor_view.h:188