RPPT Tensor Operations - Statistical Operations.#
RPPT Tensor Operations - Statistical Operations. More...
Functions | |
| RppStatus | rppt_tensor_sum (RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t tensorSumArr, Rpp32u tensorSumArrLength, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend) |
| Tensor sum operation on HIP/HOST backend for a NCHW/NHWC layout tensor. More... | |
| RppStatus | rppt_tensor_min (RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t minArr, Rpp32u minArrLength, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend) |
| Tensor min operation on HIP/HOST backend for a NCHW/NHWC layout tensor. More... | |
| RppStatus | rppt_tensor_max (RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t maxArr, Rpp32u maxArrLength, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend) |
| Tensor max operation on HIP/HOST backend for a NCHW/NHWC layout tensor. More... | |
| RppStatus | rppt_normalize (RppPtr_t srcPtr, RpptGenericDescPtr srcGenericDescPtr, RppPtr_t dstPtr, RpptGenericDescPtr dstGenericDescPtr, Rpp32u axisMask, Rpp32f *meanTensor, Rpp32f *stdDevTensor, Rpp8u computeMeanStddev, Rpp32f scale, Rpp32f shift, Rpp32u *roiTensor, rppHandle_t rppHandle, RppBackend executionBackend) |
| Normalize Generic augmentation on HIP/HOST backend. More... | |
| RppStatus | rppt_tensor_mean (RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t tensorMeanArr, Rpp32u tensorMeanArrLength, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend) |
| Tensor mean operation on HIP/HOST backend for a NCHW/NHWC layout tensor. More... | |
| RppStatus | rppt_tensor_stddev (RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t tensorStddevArr, Rpp32u tensorStddevArrLength, Rpp32f *meanTensor, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend) |
| Tensor stddev operation on HIP/HOST backend for a NCHW/NHWC layout tensor. More... | |
| RppStatus | rppt_threshold (RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32f *minTensor, Rpp32f *maxTensor, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend) |
| Threshold augmentation on HIP/HOST backend for a NCHW/NHWC layout tensor. More... | |
Detailed Description
RPPT Tensor Operations - Statistical Operations.
Function Documentation
◆ rppt_normalize()
| RppStatus rppt_normalize | ( | RppPtr_t | srcPtr, |
| RpptGenericDescPtr | srcGenericDescPtr, | ||
| RppPtr_t | dstPtr, | ||
| RpptGenericDescPtr | dstGenericDescPtr, | ||
| Rpp32u | axisMask, | ||
| Rpp32f * | meanTensor, | ||
| Rpp32f * | stdDevTensor, | ||
| Rpp8u | computeMeanStddev, | ||
| Rpp32f | scale, | ||
| Rpp32f | shift, | ||
| Rpp32u * | roiTensor, | ||
| rppHandle_t | rppHandle, | ||
| RppBackend | executionBackend | ||
| ) |
Normalize Generic augmentation on HIP/HOST backend.
Normalizes the input generic ND buffer by removing the mean and dividing by the standard deviation for a given ND Tensor. Supports u8->f32, i8->f32, f16->f16 and f32->f32 datatypes. Also has toggle variant(NHWC->NCHW) support for 3D.
- Parameters
-
[in] srcPtr source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] srcGenericDescPtr source tensor descriptor [out] dstPtr destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] dstGenericDescPtr destination tensor descriptor [in] axisMask axis along which normalization needs to be done [in] meanTensor values to be subtracted from input (in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend)) [in] stdDevTensor standard deviation values to scale the input (in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend)) [in] computeMeanStddev flag to represent internal computation of mean, stddev (Wherein 0th bit used to represent computeMean and 1st bit for computeStddev, 0- Externally provided) [in] scale value to be multiplied with data after subtracting from mean [in] shift value to be added finally [in] roiTensor values to represent dimensions of input tensor (in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend)) [in] rppHandle RPP HIP/HOST handle created with rppCreate()[in] executionBackend execution backend to run the operation on (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Returns
- A
RppStatusenumeration.
- Return values
-
RPP_SUCCESS Successful completion. RPP_ERROR* Unsuccessful completion.
◆ rppt_tensor_max()
| RppStatus rppt_tensor_max | ( | RppPtr_t | srcPtr, |
| RpptDescPtr | srcDescPtr, | ||
| RppPtr_t | maxArr, | ||
| Rpp32u | maxArrLength, | ||
| RpptROIPtr | roiTensorPtrSrc, | ||
| RpptRoiType | roiType, | ||
| rppHandle_t | rppHandle, | ||
| RppBackend | executionBackend | ||
| ) |
Tensor max operation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The tensor max is a reduction operation that finds the channel-wise (R max / G max / B max) and overall max for each image in 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.
- Parameters
-
[in] srcPtr source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] srcDescPtr source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3) [out] maxArr destination array in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] maxArrLength length of provided destination array (Restrictions - if srcDescPtr->c == 1 then maxArrLength >= srcDescPtr->n, and if srcDescPtr->c == 3 then maxArrLength >= srcDescPtr->n * 4) [in] roiTensorPtrSrc 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)) | (Restrictions - roiTensorPtrSrc[i].xywhROI.roiWidth <= 3840 and roiTensorPtrSrc[i].xywhROI.roiHeight <= 2160) [in] roiType ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB) [in] rppHandle RPP HIP/HOST handle created with rppCreate()[in] executionBackend execution backend to run the operation on (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Returns
- A
RppStatusenumeration.
- Return values
-
RPP_SUCCESS Successful completion. RPP_ERROR* Unsuccessful completion.
◆ rppt_tensor_mean()
| RppStatus rppt_tensor_mean | ( | RppPtr_t | srcPtr, |
| RpptDescPtr | srcDescPtr, | ||
| RppPtr_t | tensorMeanArr, | ||
| Rpp32u | tensorMeanArrLength, | ||
| RpptROIPtr | roiTensorPtrSrc, | ||
| RpptRoiType | roiType, | ||
| rppHandle_t | rppHandle, | ||
| RppBackend | executionBackend | ||
| ) |
Tensor mean operation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The tensor mean is a reduction operation that finds the channel-wise (R mean / G mean / B mean) and total mean for each image in 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.
- Parameters
-
[in] srcPtr source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] srcDescPtr source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3) [out] tensorMeanArr destination array in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] tensorMeanArrLength length of provided destination array (Restrictions - if srcDescPtr->c == 1 then tensorMeanArrLength = srcDescPtr->n, and if srcDescPtr->c == 3 then tensorMeanArrLength = srcDescPtr->n * 4) [in] roiTensorPtrSrc 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)) | (Restrictions - roiTensorPtrSrc[i].xywhROI.roiWidth <= 3840 and roiTensorPtrSrc[i].xywhROI.roiHeight <= 2160) [in] roiType ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB) [in] rppHandle RPP HIP/HOST handle created with rppCreate()[in] executionBackend execution backend to run the operation on (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Returns
- A
RppStatusenumeration.
- Return values
-
RPP_SUCCESS Successful completion. RPP_ERROR* Unsuccessful completion.
◆ rppt_tensor_min()
| RppStatus rppt_tensor_min | ( | RppPtr_t | srcPtr, |
| RpptDescPtr | srcDescPtr, | ||
| RppPtr_t | minArr, | ||
| Rpp32u | minArrLength, | ||
| RpptROIPtr | roiTensorPtrSrc, | ||
| RpptRoiType | roiType, | ||
| rppHandle_t | rppHandle, | ||
| RppBackend | executionBackend | ||
| ) |
Tensor min operation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The tensor min is a reduction operation that finds the channel-wise (R min / G min / B min) and overall min for each image in 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.
- Parameters
-
[in] srcPtr source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] srcDescPtr source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3) [out] minArr destination array in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] minArrLength length of provided destination array (Restrictions - if srcDescPtr->c == 1 then minArrLength >= srcDescPtr->n, and if srcDescPtr->c == 3 then minArrLength >= srcDescPtr->n * 4) [in] roiTensorPtrSrc 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)) | (Restrictions - roiTensorPtrSrc[i].xywhROI.roiWidth <= 3840 and roiTensorPtrSrc[i].xywhROI.roiHeight <= 2160) [in] roiType ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB) [in] rppHandle RPP HIP/HOST handle created with rppCreate()[in] executionBackend execution backend to run the operation on (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Returns
- A
RppStatusenumeration.
- Return values
-
RPP_SUCCESS Successful completion. RPP_ERROR* Unsuccessful completion.
◆ rppt_tensor_stddev()
| RppStatus rppt_tensor_stddev | ( | RppPtr_t | srcPtr, |
| RpptDescPtr | srcDescPtr, | ||
| RppPtr_t | tensorStddevArr, | ||
| Rpp32u | tensorStddevArrLength, | ||
| Rpp32f * | meanTensor, | ||
| RpptROIPtr | roiTensorPtrSrc, | ||
| RpptRoiType | roiType, | ||
| rppHandle_t | rppHandle, | ||
| RppBackend | executionBackend | ||
| ) |
Tensor stddev operation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The tensor stddev is a reduction operation that finds the channel-wise (R stddev / G stddev / B stddev) and total standard deviation for each image with respect to meanTensor passed.
- 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.
- Parameters
-
[in] srcPtr source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] srcDescPtr source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3) [out] tensorStddevArr destination array in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] tensorStddevArrLength length of provided destination array (Restrictions - if srcDescPtr->c == 1 then tensorStddevArrLength = srcDescPtr->n, and if srcDescPtr->c == 3 then tensorStddevArrLength = srcDescPtr->n * 4) [in] meanTensor mean values for stddev calculation (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of size batchSize * 4 in format (MeanR, MeanG, MeanB, MeanImage) for each image in batch) [in] roiTensorPtrSrc 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)) | (Restrictions - roiTensorPtrSrc[i].xywhROI.roiWidth <= 3840 and roiTensorPtrSrc[i].xywhROI.roiHeight <= 2160) [in] roiType ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB) [in] rppHandle RPP HIP/HOST handle created with rppCreate()[in] executionBackend execution backend to run the operation on (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Returns
- A
RppStatusenumeration.
- Return values
-
RPP_SUCCESS Successful completion. RPP_ERROR* Unsuccessful completion.
◆ rppt_tensor_sum()
| RppStatus rppt_tensor_sum | ( | RppPtr_t | srcPtr, |
| RpptDescPtr | srcDescPtr, | ||
| RppPtr_t | tensorSumArr, | ||
| Rpp32u | tensorSumArrLength, | ||
| RpptROIPtr | roiTensorPtrSrc, | ||
| RpptRoiType | roiType, | ||
| rppHandle_t | rppHandle, | ||
| RppBackend | executionBackend | ||
| ) |
Tensor sum operation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The tensor sum is a reduction operation that finds the channel-wise (R sum / G sum / B sum) and total sum for each image in 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.
- Parameters
-
[in] srcPtr source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] srcDescPtr source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3) [out] tensorSumArr destination array in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] tensorSumArrLength length of provided destination array (Restrictions - if srcDescPtr->c == 1 then tensorSumArrLength >= srcDescPtr->n, and if srcDescPtr->c == 3 then tensorSumArrLength >= srcDescPtr->n * 4) [in] roiTensorPtrSrc 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)) | (Restrictions - roiTensorPtrSrc[i].xywhROI.roiWidth <= 3840 and roiTensorPtrSrc[i].xywhROI.roiHeight <= 2160) [in] roiType ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB) [in] rppHandle RPP HIP/HOST handle created with rppCreate()[in] executionBackend execution backend to run the operation on (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Returns
- A
RppStatusenumeration.
- Return values
-
RPP_SUCCESS Successful completion. RPP_ERROR* Unsuccessful completion.
◆ rppt_threshold()
| RppStatus rppt_threshold | ( | RppPtr_t | srcPtr, |
| RpptDescPtr | srcDescPtr, | ||
| RppPtr_t | dstPtr, | ||
| RpptDescPtr | dstDescPtr, | ||
| Rpp32f * | minTensor, | ||
| Rpp32f * | maxTensor, | ||
| RpptROIPtr | roiTensorPtrSrc, | ||
| RpptRoiType | roiType, | ||
| rppHandle_t | rppHandle, | ||
| RppBackend | executionBackend | ||
| ) |
Threshold augmentation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The Threshold augmentation outputs a black/white binary mask image, based on whether or not each pixel is within the user-specified pixel-range bounds, 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.
Note: Returns a black image for below 2 cases:- If the minimum cutoff value greater than the maximum cutoff value for the given input in a batch.
- Values provided for minimum cutoff value, maximum cutoff value are beyond the below specified min and max values.
Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127).
Sample Input
Sample Output- Parameters
-
[in] srcPtr source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] srcDescPtr source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3) [out] dstPtr destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend) [in] dstDescPtr destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = same as that of srcDescPtr) [in] minTensor minimum cutoff value (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of size batchSize * channels) - minTensor ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127). [in] maxTensor maximum cutoff value (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of size batchSize * channels) - maxTensor ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127). [in] roiTensorPtrSrc 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)) [in] roiType ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB) [in] rppHandle RPP HIP/HOST handle created with rppCreateWithBatchSize()[in] executionBackend execution backend to run the augmentation on (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Returns
- A
RppStatusenumeration.
- Return values
-
RPP_SUCCESS Successful completion. RPP_ERROR* Unsuccessful completion.
- If the minimum cutoff value greater than the maximum cutoff value for the given input in a batch.