ImageWrapper< T > Class Template Reference

ImageWrapper&lt; T &gt; Class Template Reference#

4 min read time

Applies to Linux

rocCV: roccv::ImageWrapper< T > Class Template Reference
roccv::ImageWrapper< T > Class Template Reference

ImageWrapper is a non-owning wrapper for roccv::Tensors with a NHWC/NCHW/HWC layout. It provides methods for accessing the underlying data within HIP kernels. More...

#include <image_wrapper.hpp>

Public Types

using BaseType = detail::BaseType< T >
 
using ValueType = T
 

Public Member Functions

__device__ __host__ T & at (int64_t n, int64_t h, int64_t w, int64_t c)
 Returns a reference to data given coordinates within an image tensor. More...
 
__device__ __host__ const T at (int64_t n, int64_t h, int64_t w, int64_t c) const
 
__device__ __host__ int64_t batches () const
 Retrieves the number of batches in the image tensor. More...
 
__device__ __host__ int64_t channels () const
 Retries the number of channels in the image. More...
 
__device__ __host__ int64_t height () const
 Retrives the height of the images. More...
 
 ImageWrapper (const Tensor &tensor)
 Creates an ImageWrapper from a Tensor. More...
 
 ImageWrapper (std::vector< BaseType > &input, int32_t batchSize, int32_t width, int32_t height)
 Creates an ImageWrapper from a vector. More...
 
 ImageWrapper (void *input, int32_t batchSize, int32_t width, int32_t height)
 Creates an ImageWrapper from a pointer. More...
 
__device__ __host__ int64_t width () const
 Retrieves the width of the image. More...
 

Detailed Description

template<typename T>
class roccv::ImageWrapper< T >

ImageWrapper is a non-owning wrapper for roccv::Tensors with a NHWC/NCHW/HWC layout. It provides methods for accessing the underlying data within HIP kernels.

Template Parameters
TThe datatype of the underlying tensor data.

Member Typedef Documentation

◆ BaseType

template<typename T >
using roccv::ImageWrapper< T >::BaseType = detail::BaseType<T>

◆ ValueType

template<typename T >
using roccv::ImageWrapper< T >::ValueType = T

Constructor & Destructor Documentation

◆ ImageWrapper() [1/3]

template<typename T >
roccv::ImageWrapper< T >::ImageWrapper ( const Tensor tensor)
inline

Creates an ImageWrapper from a Tensor.

Parameters
tensorThe Tensor to be represented by the ImageWrapper.

◆ ImageWrapper() [2/3]

template<typename T >
roccv::ImageWrapper< T >::ImageWrapper ( std::vector< BaseType > &  input,
int32_t  batchSize,
int32_t  width,
int32_t  height 
)
inline

Creates an ImageWrapper from a vector.

Parameters
inputThe input vector to wrap.
batchSizeThe number of images within the batch.
widthThe width of each image within the batch.
heightThe height of each image within the batch.

◆ ImageWrapper() [3/3]

template<typename T >
roccv::ImageWrapper< T >::ImageWrapper ( void *  input,
int32_t  batchSize,
int32_t  width,
int32_t  height 
)
inline

Creates an ImageWrapper from a pointer.

Parameters
inputThe input pointer to wrap.
batchSizeThe number of images within the batch.
widthThe width of each image within the batch.
heightThe height of each image within the batch.

Member Function Documentation

◆ at() [1/2]

template<typename T >
__device__ __host__ T& roccv::ImageWrapper< T >::at ( int64_t  n,
int64_t  h,
int64_t  w,
int64_t  c 
)
inline

Returns a reference to data given coordinates within an image tensor.

Parameters
nBatch coordinates.
hHeight coordinates.
wWidth coordinates.
cChannel coordinates.
Returns
A reference to the underlying data at given coordinates.

◆ at() [2/2]

template<typename T >
__device__ __host__ const T roccv::ImageWrapper< T >::at ( int64_t  n,
int64_t  h,
int64_t  w,
int64_t  c 
) const
inline

◆ batches()

template<typename T >
__device__ __host__ int64_t roccv::ImageWrapper< T >::batches ( ) const
inline

Retrieves the number of batches in the image tensor.

Returns
Number of batches.

◆ channels()

template<typename T >
__device__ __host__ int64_t roccv::ImageWrapper< T >::channels ( ) const
inline

Retries the number of channels in the image.

Returns
Image channels.

◆ height()

template<typename T >
__device__ __host__ int64_t roccv::ImageWrapper< T >::height ( ) const
inline

Retrives the height of the images.

Returns
Image height.

◆ width()

template<typename T >
__device__ __host__ int64_t roccv::ImageWrapper< T >::width ( ) const
inline

Retrieves the width of the image.

Returns
Image width.

The documentation for this class was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/wrappers/image_wrapper.hpp