Local Response Normalization

A primitive to perform local response normalization (LRN) across or within channels.

API

struct dnnl::lrn_forward : public dnnl::primitive

Local response normalization (LRN) forward propagation primitive.

Public Functions

lrn_forward()

Default constructor. Produces an empty object.

lrn_forward(const primitive_desc &pd)

Constructs an LRN forward propagation primitive.

Parameters
  • pd: Primitive descriptor for an LRN forward propagation primitive.

struct desc

Descriptor for an LRN forward propagation primitive.

Public Functions

desc(prop_kind prop_kind, algorithm algorithm, const memory::desc &data_desc, memory::dim local_size, float alpha, float beta, float k = 1.f)

Constructs a descriptor for a LRN forward propagation primitive.

Inputs:

Outputs:

Parameters

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for an LRN forward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for an LRN forward propagation primitive.

Parameters
  • desc: Descriptor for an LRN forward propagation primitive.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for an LRN forward propagation primitive.

Parameters
  • desc: Descriptor for an LRN forward propagation primitive.

  • engine: Engine to use.

  • attr: Primitive attributes to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_desc() const

Returns a source memory descriptor.

Return

Source memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source parameter.

memory::desc dst_desc() const

Returns a destination memory descriptor.

Return

Destination memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

struct dnnl::lrn_backward : public dnnl::primitive

Local response normalization (LRN) backward propagation primitive.

Public Functions

lrn_backward()

Default constructor. Produces an empty object.

lrn_backward(const primitive_desc &pd)

Constructs an LRN backward propagation primitive.

Parameters
  • pd: Primitive descriptor for an LRN backward propagation primitive.

struct desc

Descriptor for an LRN backward propagation primitive.

Public Functions

desc(algorithm algorithm, const memory::desc &data_desc, const memory::desc &diff_data_desc, memory::dim local_size, float alpha, float beta, float k = 1.f)

Constructs a descriptor for an LRN backward propagation primitive.

Inputs:

Outputs:

Parameters
  • algorithm: LRN algorithm kind: either dnnl::algorithm::lrn_across_channels, or dnnl::algorithm::lrn_within_channel.

  • diff_data_desc: Diff source and diff destination memory descriptor.

  • data_desc: Source memory descriptor.

  • local_size: Regularization local size.

  • alpha: The alpha regularization parameter.

  • beta: The beta regularization parameter.

  • k: The k regularization parameter.

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for an LRN backward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, const lrn_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for an LRN backward propagation primitive.

Parameters
  • desc: Descriptor for an LRN backward propagation primitive.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an LRN forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const lrn_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for an LRN backward propagation primitive.

Parameters
  • desc: Descriptor for an LRN backward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an LRN forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc diff_src_desc() const

Returns a source memory descriptor.

Return

Source memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source parameter.

memory::desc diff_dst_desc() const

Returns a diff destination memory descriptor.

Return

Diff destination memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff destination parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.