Local Response Normalization Layer

Local Response Normalization types and functions.

miopenLRNMode_t

enum miopenLRNMode_t

Local Response Normalization layer mode

Values:

miopenLRNWithinChannel = 0

Channel independent

miopenLRNCrossChannel = 1

Cross Channel

miopenCreateLRNDescriptor

miopenStatus_t miopenCreateLRNDescriptor(miopenLRNDescriptor_t *lrnDesc)

Creates a local response normalization (LRN) layer descriptor.

Return
miopenStatus_t
Parameters
  • lrnDesc: Pointer to a local response normalization layer descriptor type

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.

Return
miopenStatus_t
Parameters
  • lrnDesc: Pointer to a LRN layer descriptor (output)
  • mode: LRN mode enum (input)
  • lrnN: Number of normalization window elements (input)
  • lrnAlpha: Scaling factor (input)
  • lrnBeta: Shift factor (input)
  • lrnK: K factor (input)

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.

Return
miopenStatus_t
Parameters
  • lrnDesc: Pointer to a LRN layer descriptor (input)
  • mode: LRN mode enum (output)
  • lrnN: Number of normalization window elements (output)
  • lrnAlpha: Scaling factor (output)
  • lrnBeta: Shift factor (output)
  • lrnK: K factor (output)

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.

Return
miopenStatus_t
Parameters
  • yDesc: Pointer to a LRN layer descriptor (input)
  • workSpaceSize: Output variable for workspace size (output)

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().

Return
miopenStatus_t
Parameters
  • handle: MIOpen handle (input)
  • lrnDesc: Descriptor for LRN layer (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)
  • do_backward: Boolean to toggle save data in workspace for backwards pass (input)
  • workSpace: Pointer user allocated memory (input)

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.

Return
miopenStatus_t
Parameters
  • handle: MIOpen handle (input)
  • lrnDesc: Descriptor for LRN layer (input)
  • alpha: Floating point scaling factor, allocated on the host (input)
  • yDesc: Tensor descriptor for data input tensor y (input)
  • y: Data tensor y (input)
  • dyDesc: Tensor descriptor for data input tensor dy (input)
  • dy: Data delta tensor dy (input)
  • xDesc: Tensor descriptor for input data tensor x (input)
  • x: Data tensor x (input)
  • beta: Floating point shift factor, allocated on the host (input)
  • dxDesc: Tensor descriptor for output data tensor dx(input)
  • dx: Data delta tensor x (output)
  • workSpace: Pointer user allocated memory (input)

miopenDestroyLRNDescriptor

miopenStatus_t miopenDestroyLRNDescriptor(miopenLRNDescriptor_t lrnDesc)

Destroys the LRN descriptor object.

Return
miopenStatus_t
Parameters
  • lrnDesc: LRN tensor descriptor type (input)