Resampling

A primitive to compute resampling operation on 1D, 2D, or 3D data tensor using the Nearest Neighbor, or Linear (Bilinear, Trilinear), interpolation method.

API

struct dnnl::resampling_forward : public dnnl::primitive

Resampling forward propagation.

Public Functions

resampling_forward()

Default constructor. Produces an empty object.

resampling_forward(const primitive_desc &pd)

Constructs a resampling forward propagation primitive.

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

struct desc

Descriptor for resampling forward propagation.

Public Functions

desc(prop_kind prop_kind, algorithm algorithm, const memory::desc &src_desc, const memory::desc &dst_desc)

Constructs a descriptor for a resampling forward propagation primitive using source and destination memory descriptors.

Inputs:

Outputs:

Note

The destination memory descriptor may be initialized with dnnl::memory::format_tag::any value of format_tag.

Parameters

desc(prop_kind prop_kind, algorithm algorithm, const std::vector<float> &factors, const memory::desc &src_desc)

Constructs a descriptor for a resampling forward propagation primitive using source memory descriptor and factors.

Inputs:

Parameters

desc(prop_kind prop_kind, algorithm algorithm, const std::vector<float> &factors, const memory::desc &src_desc, const memory::desc &dst_desc)

Constructs a descriptor for a resampling forward propagation primitive.

Inputs:

Outputs:

Note

The destination memory descriptor may be initialized with dnnl::memory::format_tag::any value of format_tag.

Parameters

struct primitive_desc : public dnnl::primitive_desc

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

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

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

Resampling backward propagation primitive.

Public Functions

resampling_backward()

Default constructor. Produces an empty object.

resampling_backward(const primitive_desc &pd)

Constructs a resampling backward propagation primitive.

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

struct desc

Descriptor for a resampling backward propagation primitive.

Public Functions

desc(algorithm algorithm, const memory::desc &diff_src_desc, const memory::desc &diff_dst_desc)

Constructs a descriptor for a resampling backward propagation primitive using source and destination memory descriptors.

Inputs:

Outputs:

Parameters

desc(algorithm algorithm, const std::vector<float> &factors, const memory::desc &diff_src_desc, const memory::desc &diff_dst_desc)

Constructs a descriptor for resampling backward propagation primitive.

Inputs:

Outputs:

Parameters

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for resampling backward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

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

Constructs a primitive descriptor for a resampling backward propagation primitive.

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

  • engine: Engine to use.

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

Constructs a primitive descriptor for a resampling backward propagation primitive.

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

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for a resampling 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.