NVIDIA DeepStream SDK API Reference

6.4 Release
cvcore::Tensor< CHW, CC, CT > Class Template Reference

Detailed Description

template<ChannelCount CC, ChannelType CT>
class cvcore::Tensor< CHW, CC, CT >

3D CHW tensors.

Template Parameters
CCchannel count.
CTchannel type.

Definition at line 877 of file Tensor.h.

Inheritance diagram for cvcore::Tensor< CHW, CC, CT >:
Collaboration diagram for cvcore::Tensor< CHW, CC, CT >:

Public Types

using DataType = typename detail::ChannelTypeToNative< CT >::Type
 

Public Member Functions

 Tensor ()=default
 
template<ChannelCount T = CC, typename = typename std::enable_if<T != CX>::type>
 Tensor (std::size_t width, std::size_t height, bool isCPU=true)
 
template<ChannelCount T = CC, typename = typename std::enable_if<T == CX>::type>
 Tensor (std::size_t width, std::size_t height, std::size_t channelCount, bool isCPU=true)
 
template<ChannelCount T = CC, typename = typename std::enable_if<T != CX>::type>
 Tensor (std::size_t width, std::size_t height, DataType *dataPtr, bool isCPU=true)
 
template<ChannelCount T = CC, typename B = bool, typename std::enable_if< T !=CX &&std::is_same< B, bool >::value >::type * = nullptr>
 Tensor (std::size_t width, std::size_t height, std::size_t rowPitch, DataType *dataPtr, B isCPU=true)
 
template<ChannelCount T = CC, typename = typename std::enable_if<T == CX>::type>
 Tensor (std::size_t width, std::size_t height, std::size_t channelCount, DataType *dataPtr, bool isCPU=true)
 
template<ChannelCount T = CC, typename B = bool, typename std::enable_if< T==CX &&std::is_same< B, bool >::value >::type * = nullptr>
 Tensor (std::size_t width, std::size_t height, std::size_t channelCount, std::size_t rowPitch, DataType *dataPtr, B isCPU=true)
 
std::size_t getWidth () const
 Get the width of the 3D tensor. More...
 
std::size_t getHeight () const
 Get the height of the 3D tensor. More...
 
std::size_t getChannelCount () const
 Get the channel count of the 3D tensor. More...
 
std::size_t getStride (TensorDimension dim) const
 Get the stride of the 3D tensor. More...
 
std::size_t getStride (int dimIdx) const
 Expose base getStride() function. More...
 
std::size_t getStride (int dimIdx) const
 Get the stride of given dimension. More...
 
DataTypegetData ()
 Get the raw data pointer to the 3D tensor. More...
 
const DataTypegetData () const
 Get the const raw data pointer to the 3D tensor. More...
 
void * getData () const
 Get the raw data pointer to the Tensor. 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...
 
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...
 

Static Public Attributes

static constexpr ChannelCount kChannelCount = CC
 

Member Typedef Documentation

◆ DataType

template<ChannelCount CC, ChannelType CT>
using cvcore::Tensor< CHW, CC, CT >::DataType = typename detail::ChannelTypeToNative<CT>::Type

Definition at line 880 of file Tensor.h.

Constructor & Destructor Documentation

◆ Tensor() [1/7]

template<ChannelCount CC, ChannelType CT>
cvcore::Tensor< CHW, CC, CT >::Tensor ( )
default

◆ Tensor() [2/7]

template<ChannelCount CC, ChannelType CT>
template<ChannelCount T = CC, typename = typename std::enable_if<T != CX>::type>
cvcore::Tensor< CHW, CC, CT >::Tensor ( std::size_t  width,
std::size_t  height,
bool  isCPU = true 
)
inline

Definition at line 887 of file Tensor.h.

◆ Tensor() [3/7]

template<ChannelCount CC, ChannelType CT>
template<ChannelCount T = CC, typename = typename std::enable_if<T == CX>::type>
cvcore::Tensor< CHW, CC, CT >::Tensor ( std::size_t  width,
std::size_t  height,
std::size_t  channelCount,
bool  isCPU = true 
)
inline

Definition at line 894 of file Tensor.h.

◆ Tensor() [4/7]

template<ChannelCount CC, ChannelType CT>
template<ChannelCount T = CC, typename = typename std::enable_if<T != CX>::type>
cvcore::Tensor< CHW, CC, CT >::Tensor ( std::size_t  width,
std::size_t  height,
DataType dataPtr,
bool  isCPU = true 
)
inline

Definition at line 900 of file Tensor.h.

◆ Tensor() [5/7]

template<ChannelCount CC, ChannelType CT>
template<ChannelCount T = CC, typename B = bool, typename std::enable_if< T !=CX &&std::is_same< B, bool >::value >::type * = nullptr>
cvcore::Tensor< CHW, CC, CT >::Tensor ( std::size_t  width,
std::size_t  height,
std::size_t  rowPitch,
DataType dataPtr,
isCPU = true 
)
inline

Definition at line 908 of file Tensor.h.

References cvcore::GetChannelSize().

◆ Tensor() [6/7]

template<ChannelCount CC, ChannelType CT>
template<ChannelCount T = CC, typename = typename std::enable_if<T == CX>::type>
cvcore::Tensor< CHW, CC, CT >::Tensor ( std::size_t  width,
std::size_t  height,
std::size_t  channelCount,
DataType dataPtr,
bool  isCPU = true 
)
inline

Definition at line 922 of file Tensor.h.

◆ Tensor() [7/7]

template<ChannelCount CC, ChannelType CT>
template<ChannelCount T = CC, typename B = bool, typename std::enable_if< T==CX &&std::is_same< B, bool >::value >::type * = nullptr>
cvcore::Tensor< CHW, CC, CT >::Tensor ( std::size_t  width,
std::size_t  height,
std::size_t  channelCount,
std::size_t  rowPitch,
DataType dataPtr,
isCPU = true 
)
inline

Definition at line 929 of file Tensor.h.

References cvcore::GetChannelSize().

Member Function Documentation

◆ getChannelCount()

std::size_t cvcore::detail::Tensor3D< TL, CT >::getChannelCount
inlineinherited

Get the channel count of the 3D tensor.

Returns
channel count of the 3D tensor.

Definition at line 533 of file Tensor.h.

◆ getData() [1/3]

DataType* cvcore::detail::Tensor3D< TL, CT >::getData
inlineinherited

Get the raw data pointer to the 3D tensor.

Returns
data pointer to the 3D tensor.

Definition at line 567 of file Tensor.h.

◆ getData() [2/3]

void* cvcore::TensorBase::getData ( ) const
inherited

◆ getData() [3/3]

const DataType* cvcore::detail::Tensor3D< TL, CT >::getData
inlineinherited

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

Returns
const data pointer to the 3D tensor.

Definition at line 576 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.

◆ getDimCount()

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

Get the dimension count of TensorBase.

Returns
number of dimensions.

◆ getHeight()

std::size_t cvcore::detail::Tensor3D< TL, CT >::getHeight
inlineinherited

Get the height of the 3D tensor.

Returns
height of the 3D tensor.

Definition at line 524 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]

std::size_t cvcore::TensorBase::getStride
inherited

Expose base getStride() function.

◆ getStride() [3/3]

std::size_t cvcore::detail::Tensor3D< TL, CT >::getStride ( TensorDimension  dim) const
inlineinherited

Get the stride of the 3D tensor.

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

Definition at line 548 of file Tensor.h.

◆ getType()

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

Get the ChannelType of the Tensor.

Returns
ChannelType of the Tensor.

◆ getWidth()

std::size_t cvcore::detail::Tensor3D< TL, CT >::getWidth
inlineinherited

Get the width of the 3D tensor.

Returns
width of the 3D tensor.

Definition at line 515 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.

Field Documentation

◆ kChannelCount

template<ChannelCount CC, ChannelType CT>
constexpr ChannelCount cvcore::Tensor< CHW, CC, CT >::kChannelCount = CC
staticconstexpr

Definition at line 882 of file Tensor.h.


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