Skip to main content
`Ctrl`+`K`

# Reducecalculation

MIOpen: Reducecalculation
Enumerations | Functions
Reducecalculation

## Enumerations

enum | miopenReduceCalculationOp_t { MIOPEN_REDUCE_CALCULATION_PROD , MIOPEN_REDUCE_CALCULATION_SUM }

## Functions

miopenStatus_t | miopenGetReduceCalculationWorkspaceSize (miopenHandle_t handle, const miopenTensorDescriptor_t xDesc, const int32_t dim, const miopenReduceCalculationOp_t reduceCalculationOp, const miopenTensorDescriptor_t reduceDesc, size_t *sizeInBytes)
| Helper function to query the minimum workspace size required by the ReduceTensor call.
miopenStatus_t | miopenReduceCalculationForward (miopenHandle_t handle, miopenReduceCalculationNanPropagation_t nanPropagation, void *workspace, size_t workspaceSizeInBytes, const miopenTensorDescriptor_t xDesc, const void *x, const int32_t dim, const miopenReduceCalculationOp_t reduceCalculationOp, const miopenTensorDescriptor_t reduceDesc, void *y)
| Execute a reducecalculation forward layer.

## Detailed Description

## Enumeration Type Documentation

## ◆ miopenReduceCalculationOp_t

enum miopenReduceCalculationOp_t

Reduction Calculation operation types

Enumerator
MIOPEN_REDUCE_CALCULATION_PROD | the operation is multiplying the values of the reduced elements
MIOPEN_REDUCE_CALCULATION_SUM | the operation is adding the values of the reduced elements

## Function Documentation

## ◆ miopenGetReduceCalculationWorkspaceSize()

miopenStatus_t miopenGetReduceCalculationWorkspaceSize | ( | miopenHandle_t | handle,
|  | const miopenTensorDescriptor_t | xDesc,
|  | const int32_t | dim,
|  | const miopenReduceCalculationOp_t | reduceCalculationOp,
|  | const miopenTensorDescriptor_t | reduceDesc,
|  | size_t * | sizeInBytes )

Helper function to query the minimum workspace size required by the ReduceTensor call.

Parameters

  [in] | handle | MIOpen Handle
  [in] | xDesc | Tensor descriptor for data input tensor x
  [in] | dim | Dimension to calculation.
  [in] | yDesc | Tensor descriptor for output data tensor y
  [out] | sizeInBytes | Pointer to data to return the minimum workspace size

Returns
  miopenStatus_t

## ◆ miopenReduceCalculationForward()

miopenStatus_t miopenReduceCalculationForward | ( | miopenHandle_t | handle,
|  | miopenReduceCalculationNanPropagation_t | nanPropagation,
|  | void * | workspace,
|  | size_t | workspaceSizeInBytes,
|  | const miopenTensorDescriptor_t | xDesc,
|  | const void * | x,
|  | const int32_t | dim,
|  | const miopenReduceCalculationOp_t | reduceCalculationOp,
|  | const miopenTensorDescriptor_t | reduceDesc,
|  | void * | y )

Execute a reducecalculation forward layer.

Parameters

  [in] | handle | MIOpen handle
  [in] | nanPropagation | Nan number propagation mode
  [in] | workspace | Address of the allocated workspace data
  [in] | workspaceSizeInBytes | Size in bytes of the allocated workspace data
  [in] | xDesc | Tensor descriptor for data input tensor x
  [in] | x | Data tensor x
  [in] | dim | Dimension to calculation.
  [in] | yDesc | Tensor descriptor for output data tensor y
  [out] | y | Data tensor y

Returns
  miopenStatus_t