Loading...
Searching...
No Matches
opennn::TensorView Struct Reference

#include <opennn/core/tensor_types.h>

Public Member Functions

 TensorView (void *new_data=nullptr, const Shape &new_shape={}, Type new_type=Type::FP32, Device new_device=Device::CPU) noexcept
 
void * get_data () const noexcept
 
const Shape & get_shape () const noexcept
 
Type get_type () const noexcept
 
Device get_device () const noexcept
 
Index get_rank () const noexcept
 
Index size () const
 
Index byte_size () const
 
Index flat_columns () const noexcept
 
Index flat_rows () const noexcept
 
bool empty () const noexcept
 
bool is_cuda () const noexcept
 
bool is_fp32 () const noexcept
 
bool is_bf16 () const noexcept
 
bool is_int8 () const noexcept
 
template<typename T>
T * as () const noexcept
 
float * as_float () const noexcept
 
DeviceDataType cuda_dtype () const
 
template<typename F>
void dispatch (F &&fn) const
 
TensorView reshape (const Shape &new_shape) const
 
TensorView reshape_prefix (const Shape &new_shape) const
 
MatrixMap as_matrix () const
 
MatrixMap as_matrix (Index matrix_index) const
 
MatrixMap as_flat_matrix () const
 
VectorMap as_vector () const
 
template<int Rank>
TensorMapR< Rank > as_tensor () const
 
template<int Rank>
TensorMapR< Rank > as_tensor (Index batch_index) const
 
void fill (float) const
 
void setZero () const
 
void set_zero_async () const
 
CudnnDescriptor< DnnTensorDescriptor > get_descriptor () const
 

Constructor & Destructor Documentation

◆ TensorView()

opennn::TensorView::TensorView ( void * new_data = nullptr,
const Shape & new_shape = {},
Type new_type = Type::FP32,
Device new_device = Device::CPU )
inlinenoexcept

Member Function Documentation

◆ as()

template<typename T>
T * opennn::TensorView::as ( ) const
inlinenoexcept

◆ as_flat_matrix()

MatrixMap opennn::TensorView::as_flat_matrix ( ) const
inline

◆ as_float()

float * opennn::TensorView::as_float ( ) const
inlinenoexcept

◆ as_matrix() [1/2]

MatrixMap opennn::TensorView::as_matrix ( ) const
inline

◆ as_matrix() [2/2]

MatrixMap opennn::TensorView::as_matrix ( Index matrix_index) const
inline

◆ as_tensor() [1/2]

template<int Rank>
TensorMapR< Rank > opennn::TensorView::as_tensor ( ) const
inline

◆ as_tensor() [2/2]

template<int Rank>
TensorMapR< Rank > opennn::TensorView::as_tensor ( Index batch_index) const
inline

◆ as_vector()

VectorMap opennn::TensorView::as_vector ( ) const
inline

◆ byte_size()

Index opennn::TensorView::byte_size ( ) const
inline

◆ cuda_dtype()

DeviceDataType opennn::TensorView::cuda_dtype ( ) const
inline

◆ dispatch()

template<typename F>
void opennn::TensorView::dispatch ( F && fn) const
inline

◆ empty()

bool opennn::TensorView::empty ( ) const
inlinenoexcept

◆ fill()

void opennn::TensorView::fill ( float ) const

◆ flat_columns()

Index opennn::TensorView::flat_columns ( ) const
inlinenoexcept

◆ flat_rows()

Index opennn::TensorView::flat_rows ( ) const
inlinenoexcept

◆ get_data()

void * opennn::TensorView::get_data ( ) const
inlinenoexcept

◆ get_descriptor()

CudnnDescriptor< DnnTensorDescriptor > opennn::TensorView::get_descriptor ( ) const

◆ get_device()

Device opennn::TensorView::get_device ( ) const
inlinenoexcept

◆ get_rank()

Index opennn::TensorView::get_rank ( ) const
inlinenoexcept

◆ get_shape()

const Shape & opennn::TensorView::get_shape ( ) const
inlinenoexcept

◆ get_type()

Type opennn::TensorView::get_type ( ) const
inlinenoexcept

◆ is_bf16()

bool opennn::TensorView::is_bf16 ( ) const
inlinenoexcept

◆ is_cuda()

bool opennn::TensorView::is_cuda ( ) const
inlinenoexcept

◆ is_fp32()

bool opennn::TensorView::is_fp32 ( ) const
inlinenoexcept

◆ is_int8()

bool opennn::TensorView::is_int8 ( ) const
inlinenoexcept

◆ reshape()

TensorView opennn::TensorView::reshape ( const Shape & new_shape) const
inline

◆ reshape_prefix()

TensorView opennn::TensorView::reshape_prefix ( const Shape & new_shape) const
inline

◆ set_zero_async()

void opennn::TensorView::set_zero_async ( ) const
inline

◆ setZero()

void opennn::TensorView::setZero ( ) const
inline

◆ size()

Index opennn::TensorView::size ( ) const
inline