3 #include "caffe2/operators/lstm_unit_op.h" 4 #include "caffe2/quantization/server/caffe2_dnnlowp_utils.h" 5 #include "caffe2/quantization/server/dnnlowp.h" 6 #include "caffe2/quantization/server/op_wrapper.h" 7 #include "caffe2/quantization/server/sigmoid.h" 13 static_assert(std::is_integral<T>::value,
"Integral required.");
18 bool RunOnDevice()
override;
21 const TensorCPU& InputTensorCPU_(
int idx);
23 bool GetQuantizationParameters_();
30 dnnlowp::TensorQuantizationParams H_in_qparams_, C_in_qparams_, G_in_qparams_,
31 H_out_qparams_, C_out_qparams_;
33 std::unique_ptr<OpWrapper<LSTMUnitOp<CPUContext>,
T>> fp32_op_;
34 bool dequantize_output_{
false}, measure_quantization_error_{
false};
36 std::unique_ptr<dnnlowp::QuantizationFactory> qfactory_;
39 hidden_quantization_error_stats_;
41 bool arguments_parsed_{
false};
sigmoid(x) = (tanh(x/2) + 1)/2 Quantized sigmoid is computed as tanh under the hood, we just use different input/output quantization parameters.
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
We use the 3-region approach described in "Efficient VLSI Implementation of Neural Networks with Hype...
Wrap a floating-point operator with quantized inputs with type T.