Caffe2 - C++ API
A deep learning, cross platform ML framework
int8_relu_op.cc
1 #include "caffe2/operators/quantized/int8_relu_op.h"
2 
3 namespace caffe2 {
4 
5 namespace {
6 
7 OpSchema::Cost CostInferenceForRelu(
8  const OperatorDef& def,
9  const vector<TensorShape>& in) {
10  struct OpSchema::Cost cost = PointwiseCostInference<0>(def, in);
11  cost.params_bytes = 0;
12  return cost;
13 }
14 
15 } // namespace
16 
17 REGISTER_CPU_OPERATOR(Int8Relu, int8::Int8ReluOp);
18 
19 // Input: X, output: Y
20 OPERATOR_SCHEMA(Int8Relu)
21  .NumInputs(1)
22  .NumOutputs(1)
23  .Arg("Y_scale", "Output tensor quantization scale")
24  .Arg("Y_zero_point", "Output tensor quantization offset")
25  .AllowInplace({{0, 0}})
26  .CostInferenceFunction(CostInferenceForRelu)
27  .IdenticalTypeAndShape()
28  .SetDoc(R"DOC(
29 Relu takes one input data (Tensor<T>) and produces one output data
30 (Tensor<T>) where the rectified linear function, y = max(0, x), is applied to
31 the tensor elementwise.
32 )DOC")
33  .Input(0, "X", "1D input tensor")
34  .Output(0, "Y", "1D input tensor")
35  .InheritOnnxSchema("Relu");
36 
37 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13