/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/wrappers/border_wrapper.hpp Source File#
6 min read time
Applies to Linux
border_wrapper.hpp
Go to the documentation of this file.
47 BorderWrapper(const Tensor& tensor, T border_value) : m_desc(tensor), m_border_value(border_value) {}
70 // Constant border type implementation. This is a special case which doesn't remap values, but rather returns
79 // We can return early if our coordinates are within the bounds. This is to avoid expensive calculations
80 // required at image borders. While this may cause branch divergence, a good bulk of the pixels should fall
81 // within image bounds and will take the same branch. This is preferred over having to do expensive calculations
87 // Otherwise, do some additional calculations to map the provided x and y coordinates to be within bounds.
91 // Reflect border type implementation. (Note: This is NOT REFLECT101, pixels at the border will be duplicated as
Wrapper class for ImageWrapper. This extends the descriptors by defining behaviors for when tensor co...
Definition: border_wrapper.hpp:39
__device__ __host__ int64_t batches() const
Retrieves the number of batches in the image tensor.
Definition: border_wrapper.hpp:151
__device__ __host__ int64_t width() const
Retrieves the width of the image.
Definition: border_wrapper.hpp:144
__device__ __host__ int64_t height() const
Retrives the height of the images.
Definition: border_wrapper.hpp:137
__device__ __host__ int64_t channels() const
Retries the number of channels in the image.
Definition: border_wrapper.hpp:158
BorderWrapper(ImageWrapper< T > image_wrapper, T border_value)
Constructs a BorderWrapper from an existing ImageWrapper. Extends its capabilities to handle out of b...
Definition: border_wrapper.hpp:56
BorderWrapper(const Tensor &tensor, T border_value)
Wraps an ImageWrapper and extends its capabilities to handle out of bounds coordinates.
Definition: border_wrapper.hpp:47
__device__ __host__ const T at(int64_t n, int64_t h, int64_t w, int64_t c) const
Returns a reference to the underlying data given image coordinates. If the coordinates fall out of bo...
Definition: border_wrapper.hpp:69
ImageWrapper is a non-owning wrapper for roccv::Tensors with a NHWC/NCHW/HWC layout....
Definition: image_wrapper.hpp:40
Definition: tensor.hpp:37
Definition: strided_data_wrap.hpp:33
@ BORDER_TYPE_REPLICATE
Replicates the last element for borders.
Definition: operator_types.h:38
@ BORDER_TYPE_CONSTANT
Uses a constant value for borders.
Definition: operator_types.h:37
@ BORDER_TYPE_REFLECT
Reflects the border elements.
Definition: operator_types.h:39