Softmax

Softmax#

MIOpen: Softmax

Enumerations

enum  miopenSoftmaxAlgorithm_t {
  MIOPEN_SOFTMAX_FAST = 0 ,
  MIOPEN_SOFTMAX_ACCURATE = 1 ,
  MIOPEN_SOFTMAX_LOG = 2
}
 
enum  miopenSoftmaxMode_t {
  MIOPEN_SOFTMAX_MODE_INSTANCE = 0 ,
  MIOPEN_SOFTMAX_MODE_CHANNEL
}
 

Functions

miopenStatus_t miopenSoftmaxForward (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t xDesc, const void *x, const void *beta, const miopenTensorDescriptor_t yDesc, void *y)
 Execute a softmax forward layer. More...
 
miopenStatus_t miopenSoftmaxBackward (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t yDesc, const void *y, const miopenTensorDescriptor_t dyDesc, const void *dy, const void *beta, const miopenTensorDescriptor_t dxDesc, void *dx)
 Execute a softmax backwards layer. More...
 
miopenStatus_t miopenSoftmaxForward_V2 (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t xDesc, const void *x, const void *beta, const miopenTensorDescriptor_t yDesc, void *y, miopenSoftmaxAlgorithm_t algorithm, miopenSoftmaxMode_t mode)
 Execute a softmax forward layer with expanded modes and algorithms. More...
 
miopenStatus_t miopenSoftmaxBackward_V2 (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t yDesc, const void *y, const miopenTensorDescriptor_t dyDesc, const void *dy, const void *beta, const miopenTensorDescriptor_t dxDesc, void *dx, miopenSoftmaxAlgorithm_t algorithm, miopenSoftmaxMode_t mode)
 Execute a softmax backwards layer with expanded modes and algorithms. More...
 

Detailed Description

Enumeration Type Documentation

◆ miopenSoftmaxAlgorithm_t

Softmax implementation algorithms

Enumerator
MIOPEN_SOFTMAX_FAST 

straightforward softmax

MIOPEN_SOFTMAX_ACCURATE 

scaled softmax by maximum value in input domain

MIOPEN_SOFTMAX_LOG 

log softmax

Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.1.1/include/miopen/miopen.h.

◆ miopenSoftmaxMode_t

Softmax modes

Enumerator
MIOPEN_SOFTMAX_MODE_INSTANCE 

compute per image (N) across C, H, W

MIOPEN_SOFTMAX_MODE_CHANNEL 

compute per spatial location (H, W) per image (N) across C

Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.1.1/include/miopen/miopen.h.

Function Documentation

◆ miopenSoftmaxBackward()

miopenStatus_t miopenSoftmaxBackward ( miopenHandle_t  handle,
const void *  alpha,
const miopenTensorDescriptor_t  yDesc,
const void *  y,
const miopenTensorDescriptor_t  dyDesc,
const void *  dy,
const void *  beta,
const miopenTensorDescriptor_t  dxDesc,
void *  dx 
)

Execute a softmax backwards layer.

This API only implements the SOFTMAX_MODE_CHANNEL in SOFTMAX_ACCURATE path.

Parameters
handleMIOpen handle (input)
alphaFloating point scaling factor, allocated on the host (input)
yDescTensor descriptor for input data tensor y (input)
yData tensor y (input)
dyDescTensor descriptor for input data tensor dy (input)
dyData delta tensor dy (input)
betaFloating point shift factor, allocated on the host (input)
dxDescTensor descriptor for data output tensor dx (input)
dxOutput data delta tensor dx (output)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.1.1/include/miopen/miopen.h.

◆ miopenSoftmaxBackward_V2()

miopenStatus_t miopenSoftmaxBackward_V2 ( miopenHandle_t  handle,
const void *  alpha,
const miopenTensorDescriptor_t  yDesc,
const void *  y,
const miopenTensorDescriptor_t  dyDesc,
const void *  dy,
const void *  beta,
const miopenTensorDescriptor_t  dxDesc,
void *  dx,
miopenSoftmaxAlgorithm_t  algorithm,
miopenSoftmaxMode_t  mode 
)

Execute a softmax backwards layer with expanded modes and algorithms.

Parameters
handleMIOpen handle (input)
alphaFloating point scaling factor, allocated on the host (input)
yDescTensor descriptor for input data tensor y (input)
yData tensor y (input)
dyDescTensor descriptor for input data tensor dy (input)
dyData delta tensor dy (input)
betaFloating point shift factor, allocated on the host (input)
dxDescTensor descriptor for data output tensor dx (input)
dxOutput data delta tensor dx (output)
algorithmSoftmax implementation algorithm (input)
modeSoftmax mode (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.1.1/include/miopen/miopen.h.

◆ miopenSoftmaxForward()

miopenStatus_t miopenSoftmaxForward ( miopenHandle_t  handle,
const void *  alpha,
const miopenTensorDescriptor_t  xDesc,
const void *  x,
const void *  beta,
const miopenTensorDescriptor_t  yDesc,
void *  y 
)

Execute a softmax forward layer.

This API only implements the SOFTMAX_MODE_CHANNEL in SOFTMAX_ACCURATE path.

Parameters
handleMIOpen handle (input)
alphaFloating point scaling factor, allocated on the host (input)
xDescTensor descriptor for data input tensor x (input)
xData tensor x (input)
betaFloating point shift factor, allocated on the host (input)
yDescTensor descriptor for output data tensor y (input)
yData tensor y (output)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.1.1/include/miopen/miopen.h.

◆ miopenSoftmaxForward_V2()

miopenStatus_t miopenSoftmaxForward_V2 ( miopenHandle_t  handle,
const void *  alpha,
const miopenTensorDescriptor_t  xDesc,
const void *  x,
const void *  beta,
const miopenTensorDescriptor_t  yDesc,
void *  y,
miopenSoftmaxAlgorithm_t  algorithm,
miopenSoftmaxMode_t  mode 
)

Execute a softmax forward layer with expanded modes and algorithms.

Parameters
handleMIOpen handle (input)
alphaFloating point scaling factor, allocated on the host (input)
xDescTensor descriptor for data input tensor x (input)
xData tensor x (input)
betaFloating point shift factor, allocated on the host (input)
yDescTensor descriptor for output data tensor y (input)
yData tensor y (output)
algorithmSoftmax implementation algorithm (input)
modeSoftmax mode (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.1.1/include/miopen/miopen.h.