RPP arithmetic operations#

RppStatus rppt_fused_multiply_add_scalar(RppPtr_t srcPtr, RpptGenericDescPtr srcGenericDescPtr, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, Rpp32f *mulTensor, Rpp32f *addTensor, RpptROI3DPtr roiGenericPtrSrc, RpptRoi3DType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#

Fused multiply add scalar augmentation on HIP/HOST backend.

This function performs the fmadd operation on a batch of 4D tensors. It multiplies each element of the source tensor by a corresponding element in the ‘mulTensor’, adds a corresponding element from the ‘addTensor’, and stores the result in the destination tensor. Support added for f32 -> f32 dataype.

Sample Input

Sample Input#

Sample Output

Sample Output#

Parameters:
  • srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr – [in] source tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • mulTensor – [in] mul values for fmadd calculation (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of batchSize Rpp32f values)

  • addTensor – [in] add values for fmadd calculation (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of batchSize Rpp32f values)

  • roiGenericPtrSrc – [in] ROI data for each image in source tensor (tensor of batchSize RpptRoiGeneric values)

  • roiType – [in] ROI type used (RpptRoi3DType::XYZWHD or RpptRoi3DType::LTFRBB)

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_add_scalar(RppPtr_t srcPtr, RpptGenericDescPtr srcGenericDescPtr, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, Rpp32f *addTensor, RpptROI3DPtr roiGenericPtrSrc, RpptRoi3DType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#

Add scalar augmentation on HIP/HOST backend.

This function performs the addition operation on a batch of 4D tensors. It adds a corresponding element from the ‘addTensor’ to source tensor, and stores the result in the destination tensor. Support added for f32 -> f32 dataype.

Sample Input

Sample Input#

Sample Output

Sample Output#

Parameters:
  • srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr – [in] source tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • addTensor – [in] add values for used for addition (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of batchSize Rpp32f values)

  • roiGenericPtrSrc – [in] ROI data for each image in source tensor (tensor of batchSize RpptRoiGeneric values)

  • roiType – [in] ROI type used (RpptRoi3DType::XYZWHD or RpptRoi3DType::LTFRBB)

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_subtract_scalar(RppPtr_t srcPtr, RpptGenericDescPtr srcGenericDescPtr, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, Rpp32f *subtractTensor, RpptROI3DPtr roiGenericPtrSrc, RpptRoi3DType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#

Subtract scalar augmentation on HIP/HOST backend.

This function performs the subtraction operation on a batch of 4D tensors. It takes a corresponding element from ‘subtractTensor’ and subtracts it from source tensor. Result is stored in the destination tensor. Support added for f32 -> f32 dataype.

Sample Input

Sample Input#

Sample Output

Sample Output#

Parameters:
  • srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr – [in] source tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • subtractTensor – [in] subtract values for used for subtraction (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of batchSize Rpp32f values)

  • roiGenericPtrSrc – [in] ROI data for each image in source tensor (tensor of batchSize RpptRoiGeneric values)

  • roiType – [in] ROI type used (RpptRoi3DType::XYZWHD or RpptRoi3DType::LTFRBB)

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_multiply_scalar(RppPtr_t srcPtr, RpptGenericDescPtr srcGenericDescPtr, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, Rpp32f *mulTensor, RpptROI3DPtr roiGenericPtrSrc, RpptRoi3DType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#

Multiply scalar augmentation on HIP/HOST backend.

This function performs the multiplication operation on a batch of 4D tensors. It takes a corresponding element from ‘multiplyTensor’ and multiplies it with source tensor. Result is stored in the destination tensor. Support added for f32 -> f32 dataype.

Sample Input

Sample Input#

Sample Output

Sample Output#

Parameters:
  • srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr – [in] source tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • mulTensor – [in] multiplier values for used for multiplication (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of batchSize Rpp32f values)

  • roiGenericPtrSrc – [in] ROI data for each image in source tensor (tensor of batchSize RpptRoiGeneric values)

  • roiType – [in] ROI type used (RpptRoi3DType::XYZWHD or RpptRoi3DType::LTFRBB)

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_magnitude(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#

Magnitude computation on HIP/HOST backend for a NCHW/NHWC layout tensor.

This function computes magnitude of corresponding pixels for a batch of RGB(3 channel) / greyscale(1 channel) images with an NHWC/NCHW tensor layout.

srcPtr depth ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127). dstPtr depth ranges - Will be same depth as srcPtr.

Sample Input1

Sample Input1#

Sample Input2

Sample Input2#

Sample Output

Sample Output#

Parameters:
  • srcPtr1 – [in] source1 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcPtr2 – [in] source2 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcDescPtr – [in] source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3)

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstDescPtr – [in] destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = same as that of srcDescPtr)

  • roiTensorPtrSrc – [in] ROI data in HIP memory (for HIP backend) or HOST memory (for HOST backend), for each image in source tensor (2D tensor of size batchSize * 4, in either format - XYWH(xy.x, xy.y, roiWidth, roiHeight) or LTRB(lt.x, lt.y, rb.x, rb.y))

  • roiType – [in] ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB)

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_log(RppPtr_t srcPtr, RpptGenericDescPtr srcGenericDescPtr, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, Rpp32u *roiTensor, rppHandle_t rppHandle, RppBackend executionBackend)#

Logarithm operation on HIP/HOST backend.

Computes Log to base e(natural log) of the input for a given ND Tensor. Supports u8->f32, i8->f32, f16->f16 and f32->f32 datatypes. Uses Absolute of input for log computation and uses nextafter() if input is 0 to avoid undefined result.

Parameters:
  • srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr – [in] source tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • roiTensor – [in] values to represent dimensions of input tensor (tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend))

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_log1p(RppPtr_t srcPtr, RpptGenericDescPtr srcGenericDescPtr, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, Rpp32u *roiTensor, rppHandle_t rppHandle, RppBackend executionBackend)#

Log1p operation on HIP/HOST backend.

Computes Log1p i.e (log(1 + x)) of the input for a given ND Tensor. Supports i16->f32 datatype. Uses Absolute of input for log1p computation to avoid undefined result.

Parameters:
  • srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr – [in] source tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • roiTensor – [in] values to represent dimensions of input tensor (tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend))

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_tensor_add_tensor(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RpptGenericDescPtr srcGenericDescPtr1, RpptGenericDescPtr srcGenericDescPtr2, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, RpptBroadcastMode broadcastMode, Rpp32u *roiTensor1, Rpp32u *roiTensor2, rppHandle_t rppHandle, RppBackend executionBackend)#

Tensor Add Tensor operation on HIP/HOST backend with tensor broadcasting support.

Performs element-wise addition of two N-dimensional tensors. For every axis, the two input tensors must either have the same length or one of them must be 1. DISABLE_BROADCAST can be chosen as broadcastMode only when every sample in the batch has identical dimensions.

Parameters:
  • srcPtr1 – [in] source1 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcPtr2 – [in] source2 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr1 – [in] source1 tensor descriptor

  • srcGenericDescPtr2 – [in] source2 tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • broadcastMode – [in] enum to represent broadcasting mode is disabled or not, can be set based on input tensor shape

  • roiTensor1 – [in] values to represent dimensions of first input tensor

  • roiTensor2 – [in] values to represent dimensions of second input tensor

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

  • executionBackend – [in] Backend type (RPP_HOST_BACKEND or RPP_HIP_BACKEND)

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_tensor_subtract_tensor(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RpptGenericDescPtr srcGenericDescPtr1, RpptGenericDescPtr srcGenericDescPtr2, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, RpptBroadcastMode broadcastMode, Rpp32u *roiTensor1, Rpp32u *roiTensor2, rppHandle_t rppHandle, RppBackend executionBackend)#

Tensor Subtract Tensor operation on HIP/HOST backend with tensor broadcasting support.

Performs element-wise subtraction of two N-dimensional tensors. For every axis, the two input tensors must either have the same length or one of them must be 1. DISABLE_BROADCAST can be chosen as broadcastMode only when every sample in the batch has identical dimensions.

Parameters:
  • srcPtr1 – [in] source1 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcPtr2 – [in] source2 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr1 – [in] source1 tensor descriptor

  • srcGenericDescPtr2 – [in] source2 tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • broadcastMode – [in] enum to represent broadcasting mode is disabled or not, can be set based on input tensor shape

  • roiTensor1 – [in] values to represent dimensions of first input tensor

  • roiTensor2 – [in] values to represent dimensions of second input tensor

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

  • executionBackend – [in] Backend type (RPP_HOST_BACKEND or RPP_HIP_BACKEND)

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_tensor_multiply_tensor(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RpptGenericDescPtr srcGenericDescPtr1, RpptGenericDescPtr srcGenericDescPtr2, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, RpptBroadcastMode broadcastMode, Rpp32u *roiTensor1, Rpp32u *roiTensor2, rppHandle_t rppHandle, RppBackend executionBackend)#

Tensor Multiply Tensor operation on HIP/HOST backend with tensor broadcasting support.

Performs element-wise multiplication of two N-dimensional tensors. For every axis, the two input tensors must either have the same length or one of them must be 1. DISABLE_BROADCAST can be chosen as broadcastMode only when every sample in the batch has identical dimensions.

Parameters:
  • srcPtr1 – [in] source1 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcPtr2 – [in] source2 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr1 – [in] source1 tensor descriptor

  • srcGenericDescPtr2 – [in] source2 tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • broadcastMode – [in] enum to represent broadcasting mode is disabled or not, can be set based on input tensor shape

  • roiTensor1 – [in] values to represent dimensions of first input tensor

  • roiTensor2 – [in] values to represent dimensions of second input tensor

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

  • executionBackend – [in] Backend type (RPP_HOST_BACKEND or RPP_HIP_BACKEND)

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.

RppStatus rppt_tensor_divide_tensor(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RpptGenericDescPtr srcGenericDescPtr1, RpptGenericDescPtr srcGenericDescPtr2, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, RpptBroadcastMode broadcastMode, Rpp32u *roiTensor1, Rpp32u *roiTensor2, rppHandle_t rppHandle, RppBackend executionBackend)#

Tensor Divide Tensor operation on HIP/HOST backend with tensor broadcasting support.

Performs element-wise division of two N-dimensional tensors. For every axis, the two input tensors must either have the same length or one of them must be 1. DISABLE_BROADCAST can be chosen as broadcastMode only when every sample in the batch has identical dimensions.

Parameters:
  • srcPtr1 – [in] source1 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcPtr2 – [in] source2 tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • srcGenericDescPtr1 – [in] source1 tensor descriptor

  • srcGenericDescPtr2 – [in] source2 tensor descriptor

  • dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)

  • dstGenericDescPtr – [in] destination tensor descriptor

  • broadcastMode – [in] enum to represent broadcasting mode is disabled or not, can be set based on input tensor shape

  • roiTensor1 – [in] values to represent dimensions of first input tensor

  • roiTensor2 – [in] values to represent dimensions of second input tensor

  • rppHandle – [in] RPP HIP/HOST handle created with rppCreate()

  • executionBackend – [in] Backend type (RPP_HOST_BACKEND or RPP_HIP_BACKEND)

Return values:
  • RPP_SUCCESS – Successful completion.

  • RPP_ERROR* – Unsuccessful completion.

Returns:

A RppStatus enumeration.