TensorReduce

TensorReduce#

MIOpen: TensorReduce
TensorReduce

Macros

#define MIOPEN_API_VERSION_REDUCE_TENSOR   1
 Version of TensorReduce API. Applications may use it to ensure backward compatibility with older library versions.
 

Functions

 MIOPEN_DECLARE_OBJECT (miopenReduceTensorDescriptor)
 Creates the miopenReduceTensorDescriptor_t type.
 
miopenStatus_t miopenCreateReduceTensorDescriptor (miopenReduceTensorDescriptor_t *reduceTensorDesc)
 Creates the ReduceTensor descriptor object.
 
miopenStatus_t miopenDestroyReduceTensorDescriptor (miopenReduceTensorDescriptor_t reduceTensorDesc)
 Destroy the ReduceTensor descriptor object.
 
miopenStatus_t miopenSetReduceTensorDescriptor (miopenReduceTensorDescriptor_t reduceTensorDesc, miopenReduceTensorOp_t reduceTensorOp, miopenDataType_t reduceTensorCompType, miopenNanPropagation_t reduceTensorNanOpt, miopenReduceTensorIndices_t reduceTensorIndices, miopenIndicesType_t reduceTensorIndicesType)
 Initialize a ReduceTensor descriptor object.
 
miopenStatus_t miopenGetReduceTensorDescriptor (const miopenReduceTensorDescriptor_t reduceTensorDesc, miopenReduceTensorOp_t *reduceTensorOp, miopenDataType_t *reduceTensorCompType, miopenNanPropagation_t *reduceTensorNanOpt, miopenReduceTensorIndices_t *reduceTensorIndices, miopenIndicesType_t *reduceTensorIndicesType)
 Query a ReduceTensor descriptor object.
 
miopenStatus_t miopenGetReductionIndicesSize (miopenHandle_t handle, const miopenReduceTensorDescriptor_t reduceTensorDesc, const miopenTensorDescriptor_t aDesc, const miopenTensorDescriptor_t cDesc, size_t *sizeInBytes)
 Helper function to query the minimum index space size required by the ReduceTensor call.
 
miopenStatus_t miopenGetReductionWorkspaceSize (miopenHandle_t handle, const miopenReduceTensorDescriptor_t reduceTensorDesc, const miopenTensorDescriptor_t aDesc, const miopenTensorDescriptor_t cDesc, size_t *sizeInBytes)
 Helper function to query the minimum workspace size required by the ReduceTensor call.
 
miopenStatus_t miopenReduceTensor (miopenHandle_t handle, const miopenReduceTensorDescriptor_t reduceTensorDesc, void *indices, size_t indicesSizeInBytes, void *workspace, size_t workspaceSizeInBytes, const void *alpha, const miopenTensorDescriptor_t aDesc, const void *A, const void *beta, const miopenTensorDescriptor_t cDesc, void *C)
 TensorReduce function doing reduction on tensor A by implementing C = alpha * reduceOp(A)
 

Detailed Description

Macro Definition Documentation

◆ MIOPEN_API_VERSION_REDUCE_TENSOR

#define MIOPEN_API_VERSION_REDUCE_TENSOR   1

Version of TensorReduce API. Applications may use it to ensure backward compatibility with older library versions.

  • 0 or undefined - Initial API. Supported operations: ADD, MIN, MIN, MAX.
  • 1 - Added AMAX, AVG, NORM1, NORM2 ops.

Function Documentation

◆ MIOPEN_DECLARE_OBJECT()

MIOPEN_DECLARE_OBJECT ( miopenReduceTensorDescriptor  )

Creates the miopenReduceTensorDescriptor_t type.

◆ miopenCreateReduceTensorDescriptor()

miopenStatus_t miopenCreateReduceTensorDescriptor ( miopenReduceTensorDescriptor_t *  reduceTensorDesc)

Creates the ReduceTensor descriptor object.

Parameters
reduceTensorDescPointer to a ReduceTensor descriptor type
Returns
miopenStatus_t

◆ miopenDestroyReduceTensorDescriptor()

miopenStatus_t miopenDestroyReduceTensorDescriptor ( miopenReduceTensorDescriptor_t  reduceTensorDesc)

Destroy the ReduceTensor descriptor object.

Parameters
reduceTensorDescReduceTensor descriptor type (input)
Returns
miopenStatus_t

◆ miopenGetReduceTensorDescriptor()

miopenStatus_t miopenGetReduceTensorDescriptor ( const miopenReduceTensorDescriptor_t  reduceTensorDesc,
miopenReduceTensorOp_t reduceTensorOp,
miopenDataType_t reduceTensorCompType,
miopenNanPropagation_t reduceTensorNanOpt,
miopenReduceTensorIndices_t reduceTensorIndices,
miopenIndicesType_t reduceTensorIndicesType 
)

Query a ReduceTensor descriptor object.

Parameters
reduceTensorDescPointer to the ReduceTensor descriptor object (input)
reduceTensorOpPointer to enumerant specifying the operation used by ReduceTensor (output)
reduceTensorCompTypePointer to enumerant specifying the data type used with ReduceTensor operation (output)
reduceTensorNanOptPointer to enumerant specifying the Nan number propagation mode (output)
reduceTensorIndicesPointer to enumerant specifying the indices modes used by ReduceTensor (output)
reduceTensorIndicesTypePointer to enumerant specifying the data type of the indices (output)
Returns
miopenStatus_t

◆ miopenGetReductionIndicesSize()

miopenStatus_t miopenGetReductionIndicesSize ( miopenHandle_t  handle,
const miopenReduceTensorDescriptor_t  reduceTensorDesc,
const miopenTensorDescriptor_t  aDesc,
const miopenTensorDescriptor_t  cDesc,
size_t *  sizeInBytes 
)

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

Parameters
handleMIOpen Handle (input)
reduceTensorDescPointer to the ReduceTensor descriptor object (input)
aDescPointer to the input tensor descriptor (input)
cDescPointer to the output tensor descriptor (input)
sizeInBytesPointer to data to return the minimum index space size
Returns
miopenStatus_t

◆ miopenGetReductionWorkspaceSize()

miopenStatus_t miopenGetReductionWorkspaceSize ( miopenHandle_t  handle,
const miopenReduceTensorDescriptor_t  reduceTensorDesc,
const miopenTensorDescriptor_t  aDesc,
const miopenTensorDescriptor_t  cDesc,
size_t *  sizeInBytes 
)

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

Parameters
handleMIOpen Handle (input)
reduceTensorDescPointer to the ReduceTensor descriptor object (input)
aDescPointer to the input tensor descriptor (input)
cDescPointer to the output tensor descriptor (input)
sizeInBytesPointer to data to return the minimum workspace size
Returns
miopenStatus_t

◆ miopenReduceTensor()

miopenStatus_t miopenReduceTensor ( miopenHandle_t  handle,
const miopenReduceTensorDescriptor_t  reduceTensorDesc,
void *  indices,
size_t  indicesSizeInBytes,
void *  workspace,
size_t  workspaceSizeInBytes,
const void *  alpha,
const miopenTensorDescriptor_t  aDesc,
const void *  A,
const void *  beta,
const miopenTensorDescriptor_t  cDesc,
void *  C 
)

TensorReduce function doing reduction on tensor A by implementing C = alpha * reduceOp(A)

  • beta * C

The length of each dimension of output tensor C must match the length of the corresponding dimension of input tensor A or must be equal to 1. The dimensions with length equal to 1 indicate the dimensions of A to be reduced.

Parameters
handleMIOpen Handle (input)
reduceTensorDescPointer to the ReduceTensor descriptor object (input)
indicesAddress of the allocated indices data space (output)
indicesSizeInBytesSize in bytes of the allocated indices data space (input)
workspaceAddress of the allocated workspace data (input)
workspaceSizeInBytesSize in bytes of the allocated workspace data (input)
alphaPointer to scale factor for data in input tensor A (input)
aDescPointer to the tensor descriptor for input tensor A (input)
APointer to the data of input tensor A (input)
betaPointer to scale factor for data in output tensor C (input)
cDescPointer to the tensor descriptor for output tensor C (input)
CPointer to the data of output tensor C (output)
Returns
miopenStatus_t

◆ miopenSetReduceTensorDescriptor()

miopenStatus_t miopenSetReduceTensorDescriptor ( miopenReduceTensorDescriptor_t  reduceTensorDesc,
miopenReduceTensorOp_t  reduceTensorOp,
miopenDataType_t  reduceTensorCompType,
miopenNanPropagation_t  reduceTensorNanOpt,
miopenReduceTensorIndices_t  reduceTensorIndices,
miopenIndicesType_t  reduceTensorIndicesType 
)

Initialize a ReduceTensor descriptor object.

Parameters
reduceTensorDescPointer to the ReduceTensor descriptor object (output)
reduceTensorOpEnumerant specifying the operation used by ReduceTensor (input)
reduceTensorCompTypeEnumerant specifying the data type used with ReduceTensor operation (input)
reduceTensorNanOptEnumerant specifying the Nan number propagation mode (input)
reduceTensorIndicesEnumerant specifying the indices modes used by ReduceTensor (input)
reduceTensorIndicesTypeEnumerant specifying the data type of the indices (input)
Returns
miopenStatus_t