ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::core::TensorRef Struct Reference

A minimalistic class that reference a Tensor. More...

#include <Indexer.h>

Collaboration diagram for cloudViewer::core::TensorRef:

Public Member Functions

 TensorRef ()
 
 TensorRef (const Tensor &t)
 
void Permute (const SizeVector &dims)
 Permute (dimension shuffle) the reference to a Tensor. More...
 
bool IsContiguous () const
 Returns True if the underlying memory buffer is contiguous. More...
 
bool operator== (const TensorRef &other) const
 
bool operator!= (const TensorRef &other) const
 

Public Attributes

void * data_ptr_
 
int64_t ndims_ = 0
 
int64_t dtype_byte_size_ = 0
 
int64_t shape_ [MAX_DIMS]
 
int64_t byte_strides_ [MAX_DIMS]
 

Detailed Description

A minimalistic class that reference a Tensor.

Definition at line 106 of file Indexer.h.

Constructor & Destructor Documentation

◆ TensorRef() [1/2]

cloudViewer::core::TensorRef::TensorRef ( )
inline

Definition at line 110 of file Indexer.h.

◆ TensorRef() [2/2]

Member Function Documentation

◆ IsContiguous()

bool cloudViewer::core::TensorRef::IsContiguous ( ) const
inline

Returns True if the underlying memory buffer is contiguous.

Definition at line 164 of file Indexer.h.

References byte_strides_, cloudViewer::core::shape_util::DefaultStrides(), dtype_byte_size_, ndims_, and shape_.

Referenced by cloudViewer::core::Indexer::UpdateContiguousFlags().

◆ operator!=()

bool cloudViewer::core::TensorRef::operator!= ( const TensorRef other) const
inline

Definition at line 186 of file Indexer.h.

◆ operator==()

bool cloudViewer::core::TensorRef::operator== ( const TensorRef other) const
inline

Definition at line 174 of file Indexer.h.

References byte_strides_, data_ptr_, dtype_byte_size_, ndims_, and shape_.

◆ Permute()

void cloudViewer::core::TensorRef::Permute ( const SizeVector dims)
inline

Permute (dimension shuffle) the reference to a Tensor.

Parameters
dimsThe desired ordering of dimensions.

Note: This only affects this Tensor reference, but not the underlying Tensor.

Definition at line 132 of file Indexer.h.

References byte_strides_, LogError, ndims_, shape_, cloudViewer::core::SmallVectorBase< Size_T >::size(), and cloudViewer::core::shape_util::WrapDim().

Referenced by cloudViewer::core::Indexer::ReorderDimensions().

Member Data Documentation

◆ byte_strides_

◆ data_ptr_

◆ dtype_byte_size_

int64_t cloudViewer::core::TensorRef::dtype_byte_size_ = 0

◆ ndims_

◆ shape_


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