Activation

Activation#

MIOpen: Activation
Activation

Enumerations

enum  miopenActivationMode_t {
  miopenActivationPASTHRU = 0 ,
  miopenActivationLOGISTIC = 1 ,
  miopenActivationTANH = 2 ,
  miopenActivationRELU = 3 ,
  miopenActivationSOFTRELU = 4 ,
  miopenActivationABS = 5 ,
  miopenActivationPOWER = 6 ,
  miopenActivationCLIPPEDRELU ,
  miopenActivationLEAKYRELU ,
  miopenActivationELU
}
 

Functions

 MIOPEN_DECLARE_OBJECT (miopenActivationDescriptor)
 Creates the miopenActivationDescriptor_t type. More...
 
miopenStatus_t miopenCreateActivationDescriptor (miopenActivationDescriptor_t *activDesc)
 Creates the Activation descriptor object. More...
 
miopenStatus_t miopenSetActivationDescriptor (const miopenActivationDescriptor_t activDesc, miopenActivationMode_t mode, double activAlpha, double activBeta, double activGamma)
 Sets the activation layer descriptor details. More...
 
miopenStatus_t miopenGetActivationDescriptor (const miopenActivationDescriptor_t activDesc, miopenActivationMode_t *mode, double *activAlpha, double *activBeta, double *activGamma)
 Gets the activation layer descriptor details. More...
 
miopenStatus_t miopenActivationForward (miopenHandle_t handle, const miopenActivationDescriptor_t activDesc, const void *alpha, const miopenTensorDescriptor_t xDesc, const void *x, const void *beta, const miopenTensorDescriptor_t yDesc, void *y)
 Execute an activation forward layer. More...
 
miopenStatus_t miopenActivationBackward (miopenHandle_t handle, const miopenActivationDescriptor_t activDesc, const void *alpha, const miopenTensorDescriptor_t yDesc, const void *y, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t xDesc, const void *x, const void *beta, const miopenTensorDescriptor_t dxDesc, void *dx)
 Execute a activation backwards layer. More...
 
miopenStatus_t miopenDestroyActivationDescriptor (miopenActivationDescriptor_t activDesc)
 Destroys the activation descriptor object. More...
 
miopenStatus_t miopenGLUForward (miopenHandle_t handle, const miopenTensorDescriptor_t inputDesc, const void *input, const miopenTensorDescriptor_t outputDesc, void *output, const uint32_t dim)
 Execute a GLU forward layer. More...
 
miopenStatus_t miopenGLUBackward (miopenHandle_t handle, const miopenTensorDescriptor_t inputDesc, const void *input, const miopenTensorDescriptor_t outputGradDesc, const void *outputGrad, const miopenTensorDescriptor_t inputGradDesc, void *inputGrad, const uint32_t dim)
 Execute a GLU backward layer. More...
 

Detailed Description

Enumeration Type Documentation

◆ miopenActivationMode_t

Activation layer modes

Enumerator
miopenActivationPASTHRU 

No activation, pass through the data

miopenActivationLOGISTIC 

Sigmoid function: \(1 / (1 + e^{-x})\)

miopenActivationTANH 

Tanh activation \( \beta * tanh( \alpha * x) \)

miopenActivationRELU 

Rectified Linear Unit \( max(0, x) \)

miopenActivationSOFTRELU 

\(log(1 + e^x)\)

miopenActivationABS 

Absolute value \(abs(x)\)

miopenActivationPOWER 

Scaled and shifted power \((\alpha + \beta * x)^{gamma}\)

miopenActivationCLIPPEDRELU 

Clipped Rectified Linear Unit \( min(\alpha, max(0,x)) \)

miopenActivationLEAKYRELU 

Leaky Rectified Linear Unit \( \alpha * x | x <= 0; x | x > 0 \)

miopenActivationELU 

Exponential Rectified Linear Unit \( \alpha * (e^{x} - 1) | x <= 0; x | x > 0 \)

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

Function Documentation

◆ MIOPEN_DECLARE_OBJECT()

MIOPEN_DECLARE_OBJECT ( miopenActivationDescriptor  )

Creates the miopenActivationDescriptor_t type.

Activation descriptor is an object that allows the user to specify the activation mode.

◆ miopenActivationBackward()

miopenStatus_t miopenActivationBackward ( miopenHandle_t  handle,
const miopenActivationDescriptor_t  activDesc,
const void *  alpha,
const miopenTensorDescriptor_t  yDesc,
const void *  y,
const miopenTensorDescriptor_t  dyDesc,
const void *  dy,
const miopenTensorDescriptor_t  xDesc,
const void *  x,
const void *  beta,
const miopenTensorDescriptor_t  dxDesc,
void *  dx 
)

Execute a activation backwards layer.

Parameters
handleMIOpen handle (input)
activDescDescriptor for activation layer (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)
xDescTensor descriptor for data input tensor x (input)
xData tensor x (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.3.1/include/miopen/miopen.h.

◆ miopenActivationForward()

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

Execute an activation forward layer.

Parameters
handleMIOpen handle (input)
activDescDescriptor for activation layer (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.3.1/include/miopen/miopen.h.

◆ miopenCreateActivationDescriptor()

miopenStatus_t miopenCreateActivationDescriptor ( miopenActivationDescriptor_t *  activDesc)

Creates the Activation descriptor object.

Parameters
activDescPointer to an activation tensor descriptor type
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.3.1/include/miopen/miopen.h.

◆ miopenDestroyActivationDescriptor()

miopenStatus_t miopenDestroyActivationDescriptor ( miopenActivationDescriptor_t  activDesc)

Destroys the activation descriptor object.

Parameters
activDescActivation tensor descriptor type (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.3.1/include/miopen/miopen.h.

◆ miopenGetActivationDescriptor()

miopenStatus_t miopenGetActivationDescriptor ( const miopenActivationDescriptor_t  activDesc,
miopenActivationMode_t mode,
double *  activAlpha,
double *  activBeta,
double *  activGamma 
)

Gets the activation layer descriptor details.

Retrieves all of the descriptor details for the activation layer.

Parameters
activDescPointer to a activation layer descriptor (input)
modeActivation mode enum (output)
activAlphaAlpha value for some activation modes (output)
activBetaBeta value for some activation modes (output)
activGammaGamma value for some activation modes (output)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.3.1/include/miopen/miopen.h.

◆ miopenGLUBackward()

miopenStatus_t miopenGLUBackward ( miopenHandle_t  handle,
const miopenTensorDescriptor_t  inputDesc,
const void *  input,
const miopenTensorDescriptor_t  outputGradDesc,
const void *  outputGrad,
const miopenTensorDescriptor_t  inputGradDesc,
void *  inputGrad,
const uint32_t  dim 
)

Execute a GLU backward layer.

Parameters
handleMIOpen handle (input)
inputDescTensor descriptor for input tensor (input)
inputInput tensor (input)
outputGradDescTensor descriptor for delta output tensor (input)
outputGradDelta output tensor (input)
inputGradDescTensor descriptor for delta input tensor (input)
inputGradDelta input tensor (output)
dimDimension to split the input (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.3.1/include/miopen/miopen.h.

◆ miopenGLUForward()

miopenStatus_t miopenGLUForward ( miopenHandle_t  handle,
const miopenTensorDescriptor_t  inputDesc,
const void *  input,
const miopenTensorDescriptor_t  outputDesc,
void *  output,
const uint32_t  dim 
)

Execute a GLU forward layer.

Parameters
handleMIOpen handle (input)
inputDescTensor descriptor for input tensor (input)
inputInput tensor (input)
outputDescTensor descriptor for output tensor (input)
outputOutput tensor (output)
dimDimension to split the input (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.3.1/include/miopen/miopen.h.

◆ miopenSetActivationDescriptor()

miopenStatus_t miopenSetActivationDescriptor ( const miopenActivationDescriptor_t  activDesc,
miopenActivationMode_t  mode,
double  activAlpha,
double  activBeta,
double  activGamma 
)

Sets the activation layer descriptor details.

Sets all of the descriptor details for the activation layer

Parameters
activDescPointer to a activation layer descriptor (output)
modeActivation mode enum (input)
activAlphaAlpha value for some activation modes (input)
activBetaBeta value for some activation modes (input)
activGammaGamma value for some activation modes (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/docs-6.3.1/include/miopen/miopen.h.