A fully dynamic entity that can be converted into a proper Tensor
at runtime.
More...
#include <TensorDescriptor.hpp>
Public Member Functions | |
constexpr int | getRank () const |
template<typename NewType , int NewRank, typename std::enable_if< std::is_same< NewType, Type >()||!KnownType(), int >::type = 0, typename std::enable_if< NewRank==Rank||!KnownRank(), int >::type = 0> | |
operator TensorDescriptor< NewType, NewRank > () const | |
Type conversion operator between TensorDescriptor types. More... | |
Static Public Member Functions | |
static constexpr bool | KnownType () |
Is the type known at compile-time? More... | |
static constexpr bool | KnownRank () |
Is the rank known at compile-time? More... | |
Public Attributes | |
Type * | data |
cudaDataType_t | type |
std::vector< int > | dims |
std::vector< int > | strides |
A fully dynamic entity that can be converted into a proper Tensor
at runtime.
This is useful for implementing APIs that imperatively build a description of a tensor before passing it to the library.
This object is not TensorLike
and provides no means of accessing the data. It simply stores the size, stride, data type, and base pointer of the tensor the user is describing. The expectation is that this will be fed through a runSpecialised
call at some point to convert it into a proper Tensor
using TensorDescriptorSpecialiser
.
The template parameters may be used when some information is known at compile-time to generate smaller branch trees.
Type | The data type, if known. void if this is not known until runtime. |
Rank | The dimensionality of the tensor, if known. -1 if this is not known until runtime. |
|
staticconstexpr |
Is the rank known at compile-time?
|
staticconstexpr |
Is the type known at compile-time?
sp::TensorDescriptor< Type, Rank >::operator TensorDescriptor< NewType, NewRank > | ( | ) | const |
Type conversion operator between TensorDescriptor
types.
Permits conversions that increase specialisedness, but forbids those that discard information. Conversion from unknown-type to known-type is allowed, but not the reverse, for example.