Shuffle

A primitive to shuffle tensor data along an axis.

API

struct dnnl::shuffle_forward : public dnnl::primitive

Shuffle forward propagation primitive.

Public Functions

shuffle_forward()

Default constructor. Produces an empty object.

shuffle_forward(const primitive_desc &pd)

Constructs a shuffle forward propagation primitive.

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

struct desc

Descriptor for a shuffle forward propagation primitive.

Public Functions

desc(prop_kind prop_kind, const memory::desc &data_desc, int axis, int group_size)

Constructs a descriptor for a shuffle forward propagation primitive.

Inputs:

Outputs:

Parameters

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for a shuffle forward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

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

Constructs a primitive descriptor for a shuffle forward propagation primitive.

Parameters
  • desc: Descriptor for a shuffle 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::shuffle_backward : public dnnl::primitive

Shuffle backward propagation primitive.

Public Functions

shuffle_backward()

Default constructor. Produces an empty object.

shuffle_backward(const primitive_desc &pd)

Constructs a shuffle backward propagation primitive.

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

struct desc

Descriptor for a shuffle primitive backward propagation primitive.

Public Functions

desc(const memory::desc &diff_data_desc, int axis, int group_size)

Constructs a descriptor for a shuffle backward propagation primitive.

Inputs:

Outputs:

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

  • axis: The axis along which the data is shuffled.

  • group_size: Shuffle group size.

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for a shuffle backward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

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

Constructs a primitive descriptor for a shuffle backward propagation primitive.

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

  • engine: Engine to use.

  • attr: Primitive attributes to use.

  • hint_fwd_pd: Primitive descriptor for a shuffle 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 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 diff destination memory descriptor.

Return

Diff destination memory descriptor.

Return

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