NVIDIA DeepStream SDK API Reference

6.4 Release
cvcore::detail::Tensor4D< TL, CT > Class Template Reference

Detailed Description

template<TensorLayout TL, ChannelType CT>
class cvcore::detail::Tensor4D< TL, CT >

Implementation of 4D tensors.

Template Parameters
TLtensor layout type.
CTchannel type.

Definition at line 588 of file Tensor.h.

Inheritance diagram for cvcore::detail::Tensor4D< TL, CT >:
Collaboration diagram for cvcore::detail::Tensor4D< TL, CT >:

Public Member Functions

 Tensor4D ()=default
 Default Constructor. More...
 
 Tensor4D (std::initializer_list< DimData > dimData, bool isCPU)
 Constructor of a memory-owning 4D tensor. More...
 
 Tensor4D (std::initializer_list< DimData > dimData, DataType *dataPtr, bool isCPU)
 Constructor of a non-owning 4D tensor. More...
 
std::size_t getWidth () const
 Get the width of the 4D tensor. More...
 
std::size_t getHeight () const
 Get the height of the 4D tensor. More...
 
std::size_t getDepth () const
 Get the depth of the 4D tensor. More...
 
std::size_t getChannelCount () const
 Get the channel count of the 4D tensor. More...
 
std::size_t getStride (TensorDimension dim) const
 Get the stride of the 4D tensor. More...
 
DataType * getData ()
 Get the raw data pointer to the 4D tensor. More...
 
const DataType * getData () const
 Get the const raw data pointer to the 4D tensor. More...
 
std::size_t getStride (int dimIdx) const
 Expose base getStride() function. More...
 
int getDimCount () const
 Get the dimension count of TensorBase. More...
 
std::size_t getSize (int dimIdx) const
 Get the size of given dimension. More...
 
std::size_t getStride (int dimIdx) const
 Get the stride of given dimension. More...
 
ChannelType getType () const
 Get the ChannelType of the Tensor. More...
 
std::size_t getDataSize () const
 Get the total size of the Tensor in bytes. More...
 
bool isCPU () const
 Get the flag whether the Tensor is allocated in CPU or GPU. More...
 
bool isOwning () const
 Get the flag whether the Tensor owns the data. More...
 

Constructor & Destructor Documentation

◆ Tensor4D() [1/3]

template<TensorLayout TL, ChannelType CT>
cvcore::detail::Tensor4D< TL, CT >::Tensor4D ( )
default

Default Constructor.

◆ Tensor4D() [2/3]

template<TensorLayout TL, ChannelType CT>
cvcore::detail::Tensor4D< TL, CT >::Tensor4D ( std::initializer_list< DimData dimData,
bool  isCPU 
)
inline

Constructor of a memory-owning 4D tensor.

Parameters
dimDatainitializer_list of DimData.
isCPUwhether to allocate tensor on CPU or GPU.

Definition at line 603 of file Tensor.h.

◆ Tensor4D() [3/3]

template<TensorLayout TL, ChannelType CT>
cvcore::detail::Tensor4D< TL, CT >::Tensor4D ( std::initializer_list< DimData dimData,
DataType *  dataPtr,
bool  isCPU 
)
inline

Constructor of a non-owning 4D tensor.

Parameters
dimDatainitializer_list of DimData.
dataPtrraw pointer to the source data array.
isCPUwhether to allocate tensor on CPU or GPU.

Definition at line 614 of file Tensor.h.

Member Function Documentation

◆ getChannelCount()

template<TensorLayout TL, ChannelType CT>
std::size_t cvcore::detail::Tensor4D< TL, CT >::getChannelCount ( ) const
inline

Get the channel count of the 4D tensor.

Returns
channel count of the 4D tensor.

Definition at line 650 of file Tensor.h.

◆ getData() [1/2]

template<TensorLayout TL, ChannelType CT>
DataType* cvcore::detail::Tensor4D< TL, CT >::getData ( )
inline

Get the raw data pointer to the 4D tensor.

Returns
data pointer to the 4D tensor.

Definition at line 686 of file Tensor.h.

◆ getData() [2/2]

template<TensorLayout TL, ChannelType CT>
const DataType* cvcore::detail::Tensor4D< TL, CT >::getData ( ) const
inline

Get the const raw data pointer to the 4D tensor.

Returns
const data pointer to the 4D tensor.

Definition at line 695 of file Tensor.h.

◆ getDataSize()

std::size_t cvcore::TensorBase::getDataSize ( ) const
inherited

Get the total size of the Tensor in bytes.

Returns
total bytes of the Tensor.

◆ getDepth()

template<TensorLayout TL, ChannelType CT>
std::size_t cvcore::detail::Tensor4D< TL, CT >::getDepth ( ) const
inline

Get the depth of the 4D tensor.

Returns
depth of the 4D tensor.

Definition at line 641 of file Tensor.h.

◆ getDimCount()

int cvcore::TensorBase::getDimCount ( ) const
inherited

Get the dimension count of TensorBase.

Returns
number of dimensions.

◆ getHeight()

template<TensorLayout TL, ChannelType CT>
std::size_t cvcore::detail::Tensor4D< TL, CT >::getHeight ( ) const
inline

Get the height of the 4D tensor.

Returns
height of the 4D tensor.

Definition at line 632 of file Tensor.h.

◆ getSize()

◆ getStride() [1/3]

std::size_t cvcore::TensorBase::getStride ( int  dimIdx) const
inherited

Get the stride of given dimension.

Parameters
dimIdxdimension index.
Returns
stride of the specified dimension.

◆ getStride() [2/3]

template<TensorLayout TL, ChannelType CT>
std::size_t cvcore::TensorBase::getStride

Expose base getStride() function.

◆ getStride() [3/3]

template<TensorLayout TL, ChannelType CT>
std::size_t cvcore::detail::Tensor4D< TL, CT >::getStride ( TensorDimension  dim) const
inline

Get the stride of the 4D tensor.

Parameters
dimtensor dimension.
Returns
tensor stride of the given dimension.

Definition at line 665 of file Tensor.h.

Referenced by cvcore::detail::Tensor4D< DCHW, CT >::getStride().

◆ getType()

ChannelType cvcore::TensorBase::getType ( ) const
inherited

Get the ChannelType of the Tensor.

Returns
ChannelType of the Tensor.

◆ getWidth()

template<TensorLayout TL, ChannelType CT>
std::size_t cvcore::detail::Tensor4D< TL, CT >::getWidth ( ) const
inline

Get the width of the 4D tensor.

Returns
width of the 4D tensor.

Definition at line 623 of file Tensor.h.

◆ isCPU()

bool cvcore::TensorBase::isCPU ( ) const
inherited

Get the flag whether the Tensor is allocated in CPU or GPU.

Returns
whether the Tensor is allocated in CPU.

◆ isOwning()

bool cvcore::TensorBase::isOwning ( ) const
inherited

Get the flag whether the Tensor owns the data.

Returns
whether the Tensor owns data in memory.

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