Softmax Layer#

Softmax type and layers

miopenSoftmaxAlgorithm_t#

enum miopenSoftmaxAlgorithm_t#

Softmax implementation algorithms

Values:

enumerator MIOPEN_SOFTMAX_FAST#

straightforward softmax

enumerator MIOPEN_SOFTMAX_ACCURATE#

scaled softmax by maximum value in input domain

enumerator MIOPEN_SOFTMAX_LOG#

log softmax

miopenSoftmaxMode_t#

enum miopenSoftmaxMode_t#

Softmax modes

Values:

enumerator MIOPEN_SOFTMAX_MODE_INSTANCE#

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

enumerator MIOPEN_SOFTMAX_MODE_CHANNEL#

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

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:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • xDesc – Tensor descriptor for data input tensor x (input)

  • x – Data tensor x (input)

  • beta – Floating point shift factor, allocated on the host (input)

  • yDesc – Tensor descriptor for output data tensor y (input)

  • y – Data tensor y (output)

Returns:

miopenStatus_t

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:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • yDesc – Tensor descriptor for input data tensor y (input)

  • y – Data tensor y (input)

  • dyDesc – Tensor descriptor for input data tensor dy (input)

  • dy – Data delta tensor dy (input)

  • beta – Floating point shift factor, allocated on the host (input)

  • dxDesc – Tensor descriptor for data output tensor dx (input)

  • dx – Output data delta tensor dx (output)

Returns:

miopenStatus_t

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:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • xDesc – Tensor descriptor for data input tensor x (input)

  • x – Data tensor x (input)

  • beta – Floating point shift factor, allocated on the host (input)

  • yDesc – Tensor descriptor for output data tensor y (input)

  • y – Data tensor y (output)

  • algorithm – Softmax implementation algorithm (input)

  • mode – Softmax mode (input)

Returns:

miopenStatus_t

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:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • yDesc – Tensor descriptor for input data tensor y (input)

  • y – Data tensor y (input)

  • dyDesc – Tensor descriptor for input data tensor dy (input)

  • dy – Data delta tensor dy (input)

  • beta – Floating point shift factor, allocated on the host (input)

  • dxDesc – Tensor descriptor for data output tensor dx (input)

  • dx – Output data delta tensor dx (output)

  • algorithm – Softmax implementation algorithm (input)

  • mode – Softmax mode (input)

Returns:

miopenStatus_t