1 #include "caffe2/quantization/server/elementwise_dnnlowp_op.h" 2 #include "caffe2/quantization/server/sigmoid.h" 11 explicit SigmoidFunctor() : sigmoid_() {}
13 inline void operator()(
const int n,
const T* x,
T* y) {
14 for (
int i = 0; i < n; ++i) {
15 y[i] = sigmoid_.Compute(x[i]);
19 TensorQuantizationParams GetOutputQuantizationParams()
const {
20 return sigmoid_.GetOutputQuantizationParams();
27 REGISTER_CPU_OPERATOR_WITH_ENGINE(
30 UnaryElementwiseWithArgsDNNLowPOp<
32 SigmoidFunctor<std::uint8_t>>);
34 REGISTER_CPU_OPERATOR_WITH_ENGINE(
37 UnaryElementwiseWithArgsDNNLowPOp<
39 SigmoidFunctor<std::uint8_t>>);
sigmoid(x) = (tanh(x/2) + 1)/2 Quantized sigmoid is computed as tanh under the hood, we just use different input/output quantization parameters.
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...