/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/wrappers/image_wrapper.hpp Source File#
7 min read time
Applies to Linux
image_wrapper.hpp
Go to the documentation of this file.
54 throw Exception("The given tensor layout is not supported for ImageWrapper", eStatusType::NOT_IMPLEMENTED);
62 // Handle HWC layout, which doesn't have shapes/strides for the batch dimension. We set the batch shape to 1 and
68 stride = {batch_stride, tdata.stride(indexes.h), tdata.stride(indexes.w), tdata.stride(indexes.c)};
131 return *(reinterpret_cast<T*>(data + (stride.n * n) + (stride.h * h) + (stride.w * w) + (stride.c * c)));
135 return *(reinterpret_cast<T*>(data + (stride.n * n) + (stride.h * h) + (stride.w * w) + (stride.c * c)));
Definition: exception.hpp:31
ImageWrapper is a non-owning wrapper for roccv::Tensors with a NHWC/NCHW/HWC layout....
Definition: image_wrapper.hpp:40
__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.
Definition: image_wrapper.hpp:130
ImageWrapper(void *input, int32_t batchSize, int32_t width, int32_t height)
Creates an ImageWrapper from a pointer.
Definition: image_wrapper.hpp:105
__device__ __host__ int64_t height() const
Retrives the height of the images.
Definition: image_wrapper.hpp:143
__device__ __host__ int64_t batches() const
Retrieves the number of batches in the image tensor.
Definition: image_wrapper.hpp:157
__device__ __host__ int64_t width() const
Retrieves the width of the image.
Definition: image_wrapper.hpp:150
__device__ __host__ int64_t channels() const
Retries the number of channels in the image.
Definition: image_wrapper.hpp:164
__device__ __host__ const T at(int64_t n, int64_t h, int64_t w, int64_t c) const
Definition: image_wrapper.hpp:134
ImageWrapper(const Tensor &tensor)
Creates an ImageWrapper from a Tensor.
Definition: image_wrapper.hpp:50
ImageWrapper(std::vector< BaseType > &input, int32_t batchSize, int32_t width, int32_t height)
Creates an ImageWrapper from a vector.
Definition: image_wrapper.hpp:80
virtual void * basePtr() const
Returns the base pointer of the tensor data in memory.
Holds the underlying tensor data alongside tensor metadata. This particular tensor data type is used ...
Definition: tensor_data.hpp:114
const int64_t stride(int d) const
Returns the stride at a given dimension.
Definition: tensor.hpp:37
int32_t batch_index() const
Index of the batch dimension specified by layout. E.g. returns 0 for TENSOR_LAYOUT_NHWC.
Definition: tensor_layout.hpp:111
int32_t width_index() const
Index of the width dimension specified by layout. E.g. returns 2 for TENSOR_LAYOUT_NHWC.
Definition: tensor_layout.hpp:125
int32_t height_index() const
Index of the height dimension specified by layout. E.g. returns 1 for TENSOR_LAYOUT_NHWC.
Definition: tensor_layout.hpp:118
int32_t channels_index() const
Index of the channels dimension specified by layout. E.g. returns 3 for TENSOR_LAYOUT_NHWC.
Definition: tensor_layout.hpp:132
typename TypeTraits< T >::base_type BaseType
Returns the base type of a given HIP vectorized type.
Definition: type_traits.hpp:117
Definition: strided_data_wrap.hpp:33