NVIDIA DeepStream SDK API Reference

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

Detailed Description

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

2D CL tensors.

Template Parameters
CCchannel count.
CTchannel type.

Definition at line 755 of file Tensor.h.

Inheritance diagram for cvcore::Tensor< CL, CC, CT >:
Collaboration diagram for cvcore::Tensor< CL, 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 length, bool isCPU=true)
 
template<ChannelCount T = CC, typename = typename std::enable_if<T == CX>::type>
 Tensor (std::size_t length, std::size_t channelCount, bool isCPU=true)
 
template<ChannelCount T = CC, typename = typename std::enable_if<T != CX>::type>
 Tensor (std::size_t length, DataType *dataPtr, bool isCPU=true)
 
template<ChannelCount T = CC, typename = typename std::enable_if<T == CX>::type>
 Tensor (std::size_t length, std::size_t channelCount, DataType *dataPtr, bool isCPU=true)
 
std::size_t getLength () const
 Get the length of the 2D tensor. More...
 
std::size_t getChannelCount () const
 Get the channel count of the 2D tensor. More...
 
std::size_t getStride (TensorDimension dim) const
 Get the stride of the 2D 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 2D tensor. More...
 
const DataTypegetData () const
 Get the const raw data pointer to the 2D 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< CL, CC, CT >::DataType = typename detail::ChannelTypeToNative<CT>::Type

Definition at line 758 of file Tensor.h.

Constructor & Destructor Documentation

◆ Tensor() [1/5]

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

◆ Tensor() [2/5]

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

Definition at line 765 of file Tensor.h.

◆ Tensor() [3/5]

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

Definition at line 771 of file Tensor.h.

◆ Tensor() [4/5]

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

Definition at line 777 of file Tensor.h.

◆ Tensor() [5/5]

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

Definition at line 783 of file Tensor.h.

Member Function Documentation

◆ getChannelCount()

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

Get the channel count of the 2D tensor.

Returns
channel count of the 2D tensor.

Definition at line 427 of file Tensor.h.

◆ getData() [1/3]

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

Get the raw data pointer to the 2D tensor.

Returns
data pointer to the 2D tensor.

Definition at line 459 of file Tensor.h.

◆ getData() [2/3]

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

◆ getData() [3/3]

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

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

Returns
const data pointer to the 2D tensor.

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

◆ getLength()

std::size_t cvcore::detail::Tensor2D< TL, CT >::getLength
inlineinherited

Get the length of the 2D tensor.

Returns
length of the 2D tensor.

Definition at line 418 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::Tensor2D< TL, CT >::getStride ( TensorDimension  dim) const
inlineinherited

Get the stride of the 2D tensor.

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

Definition at line 442 of file Tensor.h.

◆ getType()

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

Get the ChannelType of the Tensor.

Returns
ChannelType of the Tensor.

◆ 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< CL, CC, CT >::kChannelCount = CC
staticconstexpr

Definition at line 760 of file Tensor.h.


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