LogSoftmax

A primitive to perform logsoftmax.

API

struct dnnl::logsoftmax_forward : public dnnl::primitive

Logsoftmax forward propagation primitive.

Public Functions

logsoftmax_forward()

Default constructor. Produces an empty object.

logsoftmax_forward(const primitive_desc &pd)

Constructs a logsoftmax forward propagation primitive.

Parameters
  • pd: Primitive descriptor for a logsoftmax forward propagation primitive.

struct desc

Descriptor for a logsoftmax forward propagation primitive.

Public Functions

desc()

Default constructor. Produces an empty object.

desc(prop_kind prop_kind, const memory::desc &data_desc, int logsoftmax_axis)

Constructs a descriptor for a logsoftmax forward propagation primitive.

Inputs:

Outputs:

Parameters

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for a logsoftmax 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 a logsoftmax forward propagation primitive.

Parameters
  • desc: descriptor for a logsoftmax 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 a logsoftmax forward propagation primitive.

Parameters
  • desc: Descriptor for a logsoftmax 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.

struct dnnl::logsoftmax_backward : public dnnl::primitive

Logsoftmax backward propagation primitive.

Public Functions

logsoftmax_backward()

Default constructor. Produces an empty object.

logsoftmax_backward(const primitive_desc &pd)

Constructs a logsoftmax backward propagation primitive.

Parameters
  • pd: Primitive descriptor for a logsoftmax backward propagation primitive.

struct desc

Descriptor for a logsoftmax backward propagation primitive.

Public Functions

desc()

Default constructor. Produces an empty object.

desc(const memory::desc &diff_data_desc, const memory::desc &data_desc, int logsoftmax_axis)

Constructs a descriptor for a logsoftmax backward propagation primitive.

Inputs:

Outputs:

Parameters
  • diff_data_desc: Diff source and diff destination memory descriptors.

  • data_desc: Destination memory descriptor.

  • logsoftmax_axis: Axis over which softmax is computed.

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for a logsoftmax backward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

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

Constructs a primitive descriptor for a logsoftmax backward propagation primitive.

Parameters
  • desc: Descriptor for a logsoftmax backward propagation primitive.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for a logsoftmax 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 logsoftmax_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for a logsoftmax backward propagation primitive.

Parameters
  • desc: Descriptor for a logsoftmax backward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for a logsoftmax 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 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 diff_src_desc() const

Returns a diff source memory descriptor.

Return

Diff source memory descriptor.

Return

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

memory::desc diff_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.