Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
Data Structures | Public Types | Public Member Functions | Friends
iu::TensorGpu< PixelType > Class Template Reference

Device 4D tensor class. More...

#include <tensor_gpu.h>

Inheritance diagram for iu::TensorGpu< PixelType >:
iu::LinearDeviceMemory< PixelType, 1 > iu::LinearMemory< Ndim >

Data Structures

struct  TensorKernelData
 Struct pointer TensorKernelData that can be used in CUDA kernels. More...
 

Public Types

enum  MemoryLayout { NCHW, NHWC }
 Memory layout to access the data elements. More...
 
typedef PixelType pixel_type
 
- Public Types inherited from iu::LinearDeviceMemory< PixelType, 1 >
typedef PixelType pixel_type
 

Public Member Functions

 TensorGpu (MemoryLayout memoryLayout=NCHW)
 
virtual ~TensorGpu ()
 
 TensorGpu (const unsigned int N, const unsigned int C, const unsigned int H, const unsigned int W, MemoryLayout memoryLayout=NCHW)
 
 TensorGpu (PixelType *device_data, const unsigned int N, const unsigned int C, const unsigned int H, const unsigned int W, bool ext_data_pointer=false, MemoryLayout memoryLayout=NCHW)
 
unsigned int samples () const
 
unsigned int channels () const
 
unsigned int height () const
 
unsigned int width () const
 
MemoryLayout memoryLayout () const
 
ndarray_ref< PixelType, 4 > ref () const
 
 TensorGpu (const ndarray_ref< PixelType, 4 > &x)
 
- Public Member Functions inherited from iu::LinearDeviceMemory< PixelType, 1 >
 LinearDeviceMemory ()
 
 LinearDeviceMemory (const Size< Ndim > &size)
 
 LinearDeviceMemory (const unsigned int &numel)
 
 LinearDeviceMemory (PixelType *device_data, const Size< Ndim > &size, bool ext_data_pointer=false)
 
 LinearDeviceMemory (PixelType *device_data, const unsigned int &numel, bool ext_data_pointer=false)
 
 LinearDeviceMemory (const ndarray_ref< PixelType, Ndim > &x)
 
virtual ~LinearDeviceMemory ()
 
PixelType * data (unsigned int offset=0)
 
const PixelType * data (unsigned int offset=0) const
 
thrust::device_ptr< PixelType > begin (void)
 
thrust::device_ptr< PixelType > end (void)
 
virtual size_t bytes () const
 
virtual unsigned int bitDepth () const
 
virtual bool onDevice () const
 
ndarray_ref< PixelType, Ndim > ref () const
 
- Public Member Functions inherited from iu::LinearMemory< Ndim >
 LinearMemory ()
 
 LinearMemory (const Size< Ndim > &size)
 
 LinearMemory (const unsigned int &numel)
 
bool sameType (const LinearMemory &from)
 
virtual ~LinearMemory ()
 
unsigned int numel () const
 
Size< Ndim > size () const
 
Size< Ndim > stride () const
 

Friends

std::ostream & operator<< (std::ostream &out, TensorGpu const &tensor)
 

Additional Inherited Members

- Static Public Attributes inherited from iu::LinearDeviceMemory< PixelType, 1 >
static const unsigned int ndim
 
- Protected Member Functions inherited from iu::LinearMemory< Ndim >
void computeStride ()
 
- Protected Attributes inherited from iu::LinearMemory< Ndim >
Size< Ndim > size_
 

Detailed Description

template<typename PixelType>
class iu::TensorGpu< PixelType >

Device 4D tensor class.

Member Typedef Documentation

template<typename PixelType>
typedef PixelType iu::TensorGpu< PixelType >::pixel_type

Define the current pixel type.

Member Enumeration Documentation

template<typename PixelType>
enum iu::TensorGpu::MemoryLayout

Memory layout to access the data elements.

Defines how the elements are laid out in the memory.

  • NCHW: Samples - channels - height - width
  • NHWC: Samples - height - width - channels

Constructor & Destructor Documentation

template<typename PixelType>
iu::TensorGpu< PixelType >::TensorGpu ( MemoryLayout  memoryLayout = NCHW)
inline

Constructor.

Parameters
memoryLayoutMemoryLayout
template<typename PixelType>
virtual iu::TensorGpu< PixelType >::~TensorGpu ( )
inlinevirtual

Destructor.

template<typename PixelType>
iu::TensorGpu< PixelType >::TensorGpu ( const unsigned int  N,
const unsigned int  C,
const unsigned int  H,
const unsigned int  W,
MemoryLayout  memoryLayout = NCHW 
)
inline

Special constructor.

Parameters
NNumber of samples
CNumber of channels
HHeight
WWidth
memoryLayoutMemoryLayout
template<typename PixelType>
iu::TensorGpu< PixelType >::TensorGpu ( PixelType *  device_data,
const unsigned int  N,
const unsigned int  C,
const unsigned int  H,
const unsigned int  W,
bool  ext_data_pointer = false,
MemoryLayout  memoryLayout = NCHW 
)
inline

Special constructor.

Parameters
device_dataDevice data pointer
NNumber of samples
CNumber of channels
HHeight
WWidth
ext_data_pointerUse external data pointer as internal data pointer
memoryLayoutMemoryLayout
template<typename PixelType>
iu::TensorGpu< PixelType >::TensorGpu ( const ndarray_ref< PixelType, 4 > &  x)

construct from ndarray_ref – include ndarray/ndarray_iu.h

Member Function Documentation

template<typename PixelType>
unsigned int iu::TensorGpu< PixelType >::channels ( ) const
inline

Returns the number of channels.

template<typename PixelType>
unsigned int iu::TensorGpu< PixelType >::height ( ) const
inline

Returns height.

template<typename PixelType>
MemoryLayout iu::TensorGpu< PixelType >::memoryLayout ( ) const
inline

Returns MemoryLayout.

template<typename PixelType>
ndarray_ref<PixelType,4> iu::TensorGpu< PixelType >::ref ( ) const

convert to ndarray_ref – include ndarray/ndarray_iu.h

template<typename PixelType>
unsigned int iu::TensorGpu< PixelType >::samples ( ) const
inline

Returns the number of samples.

template<typename PixelType>
unsigned int iu::TensorGpu< PixelType >::width ( ) const
inline

Returns width.

Friends And Related Function Documentation

template<typename PixelType>
std::ostream& operator<< ( std::ostream &  out,
TensorGpu< PixelType > const &  tensor 
)
friend

Operator<< overloading. Output of TensorGpu class.


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