This page contains proposed changes for a future release of ROCm. Read the latest Linux release of ROCm documentation for your production environments.

LRN

LRN#

MIOpen: LRN

Enumerations

enum  miopenLRNMode_t {
  miopenLRNWithinChannel = 0 ,
  miopenLRNCrossChannel = 1
}
 

Functions

 MIOPEN_DECLARE_OBJECT (miopenLRNDescriptor)
 Creates the miopenLRNDescriptor_t type. More...
 
miopenStatus_t miopenCreateLRNDescriptor (miopenLRNDescriptor_t *lrnDesc)
 Creates a local response normalization (LRN) layer descriptor. More...
 
miopenStatus_t miopenSetLRNDescriptor (const miopenLRNDescriptor_t lrnDesc, miopenLRNMode_t mode, unsigned int lrnN, double lrnAlpha, double lrnBeta, double lrnK)
 Sets a LRN layer descriptor details. More...
 
miopenStatus_t miopenGetLRNDescriptor (const miopenLRNDescriptor_t lrnDesc, miopenLRNMode_t *mode, unsigned int *lrnN, double *lrnAlpha, double *lrnBeta, double *lrnK)
 Gets a LRN layer descriptor details. More...
 
miopenStatus_t miopenLRNGetWorkSpaceSize (const miopenTensorDescriptor_t yDesc, size_t *workSpaceSize)
 Determine the workspace requirements. More...
 
miopenStatus_t miopenLRNForward (miopenHandle_t handle, const miopenLRNDescriptor_t lrnDesc, const void *alpha, const miopenTensorDescriptor_t xDesc, const void *x, const void *beta, const miopenTensorDescriptor_t yDesc, void *y, bool do_backward, void *workSpace)
 Execute a LRN forward layer. More...
 
miopenStatus_t miopenLRNBackward (miopenHandle_t handle, const miopenLRNDescriptor_t lrnDesc, 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, const void *workSpace)
 Execute a LRN backward layer. More...
 
miopenStatus_t miopenDestroyLRNDescriptor (miopenLRNDescriptor_t lrnDesc)
 Destroys the LRN descriptor object. More...
 

Detailed Description

Enumeration Type Documentation

◆ miopenLRNMode_t

Local Response Normalization layer mode

Enumerator
miopenLRNWithinChannel 

Channel independent

miopenLRNCrossChannel 

Cross Channel

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

Function Documentation

◆ MIOPEN_DECLARE_OBJECT()

MIOPEN_DECLARE_OBJECT ( miopenLRNDescriptor  )

Creates the miopenLRNDescriptor_t type.

LRN descriptor is an object that allows the user to specify the LRN mode, the number of elements in the normalization window, and the LRN k-parameter.

◆ miopenCreateLRNDescriptor()

miopenStatus_t miopenCreateLRNDescriptor ( miopenLRNDescriptor_t *  lrnDesc)

Creates a local response normalization (LRN) layer descriptor.

Parameters
lrnDescPointer to a local response normalization layer descriptor type
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/develop/include/miopen/miopen.h.

◆ miopenDestroyLRNDescriptor()

miopenStatus_t miopenDestroyLRNDescriptor ( miopenLRNDescriptor_t  lrnDesc)

Destroys the LRN descriptor object.

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

◆ miopenGetLRNDescriptor()

miopenStatus_t miopenGetLRNDescriptor ( const miopenLRNDescriptor_t  lrnDesc,
miopenLRNMode_t mode,
unsigned int *  lrnN,
double *  lrnAlpha,
double *  lrnBeta,
double *  lrnK 
)

Gets a LRN layer descriptor details.

Retrieve the LRN descriptor details.

Parameters
lrnDescPointer to a LRN layer descriptor (input)
modeLRN mode enum (output)
lrnNNumber of normalization window elements (output)
lrnAlphaScaling factor (output)
lrnBetaShift factor (output)
lrnKK factor (output)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/develop/include/miopen/miopen.h.

◆ miopenLRNBackward()

miopenStatus_t miopenLRNBackward ( miopenHandle_t  handle,
const miopenLRNDescriptor_t  lrnDesc,
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,
const void *  workSpace 
)

Execute a LRN backward layer.

Parameters
handleMIOpen handle (input)
lrnDescDescriptor for LRN layer (input)
alphaFloating point scaling factor, allocated on the host (input)
yDescTensor descriptor for data input tensor y (input)
yData tensor y (input)
dyDescTensor descriptor for data input tensor dy (input)
dyData delta tensor dy (input)
xDescTensor descriptor for input data tensor x (input)
xData tensor x (input)
betaFloating point shift factor, allocated on the host (input)
dxDescTensor descriptor for output data tensor dx(input)
dxData delta tensor x (output)
workSpacePointer user allocated memory (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/develop/include/miopen/miopen.h.

◆ miopenLRNForward()

miopenStatus_t miopenLRNForward ( miopenHandle_t  handle,
const miopenLRNDescriptor_t  lrnDesc,
const void *  alpha,
const miopenTensorDescriptor_t  xDesc,
const void *  x,
const void *  beta,
const miopenTensorDescriptor_t  yDesc,
void *  y,
bool  do_backward,
void *  workSpace 
)

Execute a LRN forward layer.

Runs the forward layer normalization in the forward direction. If do_backward == 0, then set workSpace = nullptr and workSpaceSize = 0. However, if the user wishes to execute backwards, then they must set do_backwards = 1 in miopenLRNForward().

Parameters
handleMIOpen handle (input)
lrnDescDescriptor for LRN 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)
do_backwardBoolean to toggle save data in workspace for backwards pass (input)
workSpacePointer user allocated memory (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/develop/include/miopen/miopen.h.

◆ miopenLRNGetWorkSpaceSize()

miopenStatus_t miopenLRNGetWorkSpaceSize ( const miopenTensorDescriptor_t  yDesc,
size_t *  workSpaceSize 
)

Determine the workspace requirements.

This function determines the GPU memory allocation required to execute the LRN layer based on the LRN descriptor.

Parameters
yDescPointer to a LRN layer descriptor (input)
workSpaceSizeOutput variable for workspace size (output)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/develop/include/miopen/miopen.h.

◆ miopenSetLRNDescriptor()

miopenStatus_t miopenSetLRNDescriptor ( const miopenLRNDescriptor_t  lrnDesc,
miopenLRNMode_t  mode,
unsigned int  lrnN,
double  lrnAlpha,
double  lrnBeta,
double  lrnK 
)

Sets a LRN layer descriptor details.

Sets all of the descriptor details for the LRN layer. The number of window elements lrnN is a diameter and always odd.

Parameters
lrnDescPointer to a LRN layer descriptor (output)
modeLRN mode enum (input)
lrnNNumber of normalization window elements (input)
lrnAlphaScaling factor (input)
lrnBetaShift factor (input)
lrnKK factor (input)
Returns
miopenStatus_t
Examples
/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-miopen/checkouts/develop/include/miopen/miopen.h.