cutlass::TensorView< T > Class Template Reference

Host-side reference implementation of tensor operations.

`#include <tensor_view.h>`

Inheritance diagram for cutlass::TensorView< T >:

## Public Types

typedef TensorRef< T, 4 > | Base
| Reference and stride. More...
typedef Base | TensorRef_t
| Reference and stride. More...
typedef TensorRef< T const, 4 > | ConstTensorRef_t
| Reference to constant type. More...
typedef int | Offset_t
| Type used to compute the offset of an element to the base of a tensor. More...
typedef Coord< Rank > | Coord_t
| Coordinate into tensor. More...
Public Types inherited from cutlass::TensorRef< T, 4 >
typedef T | Storage
| Data type of individual access. More...

## Public Member Functions

CUTLASS_HOST_DEVICE | TensorView ()
| Default constructor. More...
CUTLASS_HOST_DEVICE | TensorView (TensorRef_t const &_ref, Coord_t const &_size)
| Constructs a Tensor_view from a TensorRef and size. More...
CUTLASS_HOST_DEVICE bool | good () const
| Returns true if the Tensor_view is bound to some memory. More...
CUTLASS_HOST_DEVICE T * | data () const
| Returns a pointer to data. More...
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. More...
CUTLASS_HOST_DEVICE TensorRef_t & | ref ()
| Accesses the tensor reference pointing to data. More...
CUTLASS_HOST_DEVICE ConstTensorRef_t | const_ref ()
CUTLASS_HOST_DEVICE TensorRef_t const & | ref () const
| Accesses the tensor reference pointing to data. More...
CUTLASS_HOST_DEVICE Coord_t const & | size () const
| Accesses the size. More...
CUTLASS_HOST_DEVICE int | size (int dim) const
| Accesses the size. More...
CUTLASS_HOST_DEVICE Coord_t const & | stride () const
| Accesses the stride. More...
CUTLASS_HOST_DEVICE int const & | stride (int dim) const
| Accesses the stride. More...
CUTLASS_HOST_DEVICE TensorView & | operator= (TensorView const &_tensor)
| Assigns the Tensor_view. More...
CUTLASS_HOST_DEVICE Offset_t | offset (Coord_t const &coord) const
| Returns the index of an element. More...
CUTLASS_HOST_DEVICE bool | contains (Coord_t const &coord) const
| Determines whether a location is within a tensor. More...
CUTLASS_HOST_DEVICE T & | at (Coord_t const &coord) const
| Element-wise accessor. More...
T & | operator[] (Coord< Rank > const &coord) const
| Element-wise accessor. More...
CUTLASS_HOST_DEVICE T & | at (Offset_t idx) const
| Element-wise accessor. More...
CUTLASS_HOST_DEVICE TensorView< T > | subview (Coord_t const &location, Coord_t size) const
| Returns a Tensor_view given location and size quantities. More...
Public Member Functions inherited from cutlass::TensorRef< T, 4 >
CUTLASS_HOST_DEVICE | TensorRef ()
| Default ctor. More...
CUTLASS_HOST_DEVICE | TensorRef (Storage *ptr, Coord< Rank > stride)
| Constructs from a pointer, size, and stride. More...
CUTLASS_HOST_DEVICE void | reset (Storage *ptr=nullptr, Coord< Rank > stride=Coord< Rank >(0))
| Updates the pointer, stride, and location within a TensorRef. More...
TensorRef< T, Rank > | convert ()
| Conversion function. More...
CUTLASS_HOST_DEVICE bool | good () const
| Returns true if the TensorRef may be safely accessed. More...
CUTLASS_HOST_DEVICE Storage * | data () const
| Returns the pointer to referenced data. More...
CUTLASS_HOST_DEVICE Coord< Rank > const & | stride () const
| Returns the stride of the tensor. More...
CUTLASS_HOST_DEVICE int const & | stride (int dim) const
| Returns the stride of the tensor in the given dimension. More...
CUTLASS_HOST_DEVICE int | leading_dim () const
| Returns the maximum stride element as the 'leading dimension'. More...
CUTLASS_HOST_DEVICE long long | offset (Coord< Rank > const &coord) const
| Computes the offset of an index from the origin of the tensor. More...
CUTLASS_HOST_DEVICE Storage & | at (Coord< Rank > const &coord) const
| Returns a reference to the element at a given Coord. More...
CUTLASS_HOST_DEVICE Storage & | at (int idx) const
| Returns a reference to the element at a given Coord. More...
Storage & | operator[] (Coord< Rank > const &coord) const
| Element-wise accessor. More...
Storage & | operator[] (int idx) const
| Element-wise accessor. More...
CUTLASS_HOST_DEVICE TensorRef & | advance (Coord< Rank > const &b)
| Adds an offset to the pointer. More...
CUTLASS_HOST_DEVICE TensorRef | operator+ (Coord< Rank > const &b) const
| Returns a TensorRef offset by a given amount. More...
CUTLASS_HOST_DEVICE TensorRef | operator- (Coord< Rank > const &b) const
| Returns a TensorRef offset by a given amount. More...

## Static Public Attributes

static int const | Rank = TensorRef_t::Rank
| Rank of tensor. More...
Static Public Attributes inherited from cutlass::TensorRef< T, 4 >
static int const | Rank
| Rank of tensor. More...

## Member Typedef Documentation

## Base

template<typename T>

typedef TensorRef<T, 4> cutlass::TensorView< T >::Base

## ConstTensorRef_t

template<typename T>

typedef TensorRef<T const, 4> cutlass::TensorView< T >::ConstTensorRef_t

## Coord_t

template<typename T>

typedef Coord<Rank> cutlass::TensorView< T >::Coord_t

## Offset_t

template<typename T>

typedef int cutlass::TensorView< T >::Offset_t

## TensorRef_t

template<typename T>

typedef Base cutlass::TensorView< T >::TensorRef_t

## Constructor & Destructor Documentation

## TensorView() [1/2]

template<typename T>

CUTLASS_HOST_DEVICE cutlass::TensorView< T >::TensorView | ( |  | ) |

inline

## TensorView() [2/2]

template<typename T>

CUTLASS_HOST_DEVICE cutlass::TensorView< T >::TensorView | ( | TensorRef_t const & | _ref,
|  | Coord_t const & | _size
| ) |  |

inline

## Member Function Documentation

## at() [1/2]

template<typename T>

CUTLASS_HOST_DEVICE T& cutlass::TensorView< T >::at | ( | Coord_t const & | coord | ) | const

inline

## at() [2/2]

template<typename T>

CUTLASS_HOST_DEVICE T& cutlass::TensorView< T >::at | ( | Offset_t | idx | ) | const

inline

## const_ref()

template<typename T>

CUTLASS_HOST_DEVICE ConstTensorRef_t cutlass::TensorView< T >::const_ref | ( |  | ) |

inline

## contains()

template<typename T>

CUTLASS_HOST_DEVICE bool cutlass::TensorView< T >::contains | ( | Coord_t const & | coord | ) | const

inline

## data()

template<typename T>

CUTLASS_HOST_DEVICE T* cutlass::TensorView< T >::data | ( |  | ) | const

inline

## good()

template<typename T>

CUTLASS_HOST_DEVICE bool cutlass::TensorView< T >::good | ( |  | ) | const

inline

## offset()

template<typename T>

CUTLASS_HOST_DEVICE Offset_t cutlass::TensorView< T >::offset | ( | Coord_t const & | coord | ) | const

inline

## operator=()

template<typename T>

CUTLASS_HOST_DEVICE TensorView& cutlass::TensorView< T >::operator= | ( | TensorView< T > const & | _tensor | ) |

inline

## operator[]()

template<typename T>

T& cutlass::TensorView< T >::operator[] | ( | Coord< Rank > const & | coord | ) | const

inline

## ref() [1/2]

template<typename T>

CUTLASS_HOST_DEVICE TensorRef_t& cutlass::TensorView< T >::ref | ( |  | ) |

inline

## ref() [2/2]

template<typename T>

CUTLASS_HOST_DEVICE TensorRef_t const& cutlass::TensorView< T >::ref | ( |  | ) | const

inline

## reset()

template<typename T>

CUTLASS_HOST_DEVICE void cutlass::TensorView< T >::reset | ( | TensorRef_t const & | _ref = `TensorRef_t(0)`,
|  | Coord_t const & | _size = `Coord_t()`
| ) |  |

inline

## size() [1/2]

template<typename T>

CUTLASS_HOST_DEVICE Coord_t const& cutlass::TensorView< T >::size | ( |  | ) | const

inline

## size() [2/2]

template<typename T>

CUTLASS_HOST_DEVICE int cutlass::TensorView< T >::size | ( | int | dim | ) | const

inline

## stride() [1/2]

template<typename T>

CUTLASS_HOST_DEVICE Coord_t const& cutlass::TensorView< T >::stride | ( |  | ) | const

inline

## stride() [2/2]

template<typename T>

CUTLASS_HOST_DEVICE int const& cutlass::TensorView< T >::stride | ( | int | dim | ) | const

inline

## subview()

template<typename T>

CUTLASS_HOST_DEVICE TensorView<T> cutlass::TensorView< T >::subview | ( | Coord_t const & | location,
|  | Coord_t | size
| ) |  | const

inline

## Member Data Documentation

## Rank

template<typename T>

int const cutlass::TensorView< T >::Rank = TensorRef_t::Rank

static

The documentation for this class was generated from the following file:

- tensor_view.h