Skip to main content
`Ctrl`+`K`

# LRN

MIOpen: LRN
Enumerations | Functions
LRN

## Enumerations

enum | miopenLRNMode_t { miopenLRNWithinChannel = 0 , miopenLRNCrossChannel = 1 }

## Functions

| MIOPEN_DECLARE_OBJECT (miopenLRNDescriptor)
| Creates the miopenLRNDescriptor_t type.
miopenStatus_t | miopenCreateLRNDescriptor (miopenLRNDescriptor_t *lrnDesc)
| Creates a local response normalization (LRN) layer descriptor.
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.
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.
miopenStatus_t | miopenLRNGetWorkSpaceSize (const miopenTensorDescriptor_t yDesc, size_t *workSpaceSize)
| Determine the workspace requirements.
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.
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.
miopenStatus_t | miopenDestroyLRNDescriptor (miopenLRNDescriptor_t lrnDesc)
| Destroys the LRN descriptor object.

## Detailed Description

## Enumeration Type Documentation

## ◆ miopenLRNMode_t

enum miopenLRNMode_t

Local Response Normalization layer mode

Enumerator
miopenLRNWithinChannel | Channel independent
miopenLRNCrossChannel | Cross Channel

## 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

  lrnDesc | Pointer to a local response normalization layer descriptor type

Returns
  miopenStatus_t

## ◆ miopenDestroyLRNDescriptor()

miopenStatus_t miopenDestroyLRNDescriptor | ( | miopenLRNDescriptor_t | lrnDesc | ) |

Destroys the LRN descriptor object.

Parameters

  lrnDesc | LRN tensor descriptor type (input)

Returns
  miopenStatus_t

## ◆ 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

  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)

Returns
  miopenStatus_t

## ◆ 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

  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)

Returns
  miopenStatus_t

## ◆ 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

  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)

Returns
  miopenStatus_t

## ◆ 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

  yDesc | Pointer to a LRN layer descriptor (input)
  workSpaceSize | Output variable for workspace size (output)

Returns
  miopenStatus_t

## ◆ 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

  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)

Returns
  miopenStatus_t