Primitive attributes. More...
#include <dnnl.hpp>
Public Member Functions | |
primitive_attr () | |
Creates default primitive attributes. | |
primitive_attr (dnnl_primitive_attr_t attr) | |
Creates primitive attributes from a C dnnl_primitive_attr_t handle. More... | |
scratchpad_mode | get_scratchpad_mode () const |
Returns the scratchpad mode. | |
void | set_scratchpad_mode (scratchpad_mode mode) |
Sets scratchpad mode. | |
void | get_output_scales (int &mask, std::vector< float > &scales) const |
Gets correspondence scale mask and a constant floating point vector of output scales previously set by set_output_scales. More... | |
void | set_output_scales (int mask, const std::vector< float > &scales) |
Sets output scales for primitive operations. More... | |
const post_ops | get_post_ops () const |
Returns post_ops previously set by set_post_ops. | |
void | set_post_ops (post_ops ops) |
Sets post_ops for future use. | |
void | set_rnn_data_qparams (float scale, float shift) |
Sets quantization scale and shift for RNN data tensors. More... | |
void | set_rnn_weights_qparams (int mask, const std::vector< float > &scales) |
Sets quantization scales weights_scales for RNN weights tensors. More... | |
Public Member Functions inherited from dnnl::handle< dnnl_primitive_attr_t > | |
handle ()=default | |
Empty constructor. More... | |
handle (dnnl_primitive_attr_t t, bool weak=false) | |
Constructs a C handle wrapper from a C handle. More... | |
void | reset (dnnl_primitive_attr_t t, bool weak=false) |
Resets the value of a C handle. More... | |
dnnl_primitive_attr_t | get (bool allow_emtpy=false) const |
Returns the value of the underlying C handle. | |
Primitive attributes.
|
inline |
Creates primitive attributes from a C dnnl_primitive_attr_t handle.
The resulting handle is never weak and the C handle will be destroyed during the destruction of the C++ object.
|
inline |
Gets correspondence scale mask
and a constant floating point vector of output scales
previously set by set_output_scales.
|
inline |
Sets output scales for primitive operations.
The correspondence scale mask
is stored for future use.
The mask
argument defines the correspondence between the output tensor dimensions and the scales
vector. Set the i-th bit of mask
to 1 to use a dedicated scaling factor for each slice of the output tensor over the i-th dimension. Set mask
to 0 to use a common scaling factor for the whole output tensor.
|
inline |
Sets quantization scale
and shift
for RNN data tensors.
For performance reasons, the low-precision configuration of the RNN primitive expects input activations to have the unsigned int8 data type. Scale and shift used to quantize floating-point data to unsigned integer must be passed to the RNN primitive using attributes.
|
inline |
Sets quantization scales weights_scales
for RNN weights tensors.
The low-precision configuration of the RNN primitive expects input weights to have the signed int8 data type. Scales used to quantize floating-point data to signed integer must be passed to the RNN primitive using attributes. The mask
argument defines correspondence between output tensor dimensions and the weights_scales
array. Set the i-th bit of mask
to 1 to use a dedicated scaling factor for each slice of the output tensor over the i-th dimension. Set mask
to 0 to use a common scaling factor for the whole output tensor.
count
corresponds to mask
until an actual primitive descriptor is created, so it is the user's responsibility to set proper values. The following formula must hold:\[count = \prod\limits_{d \in mask} output.dims[d]\]