1 #ifndef CAFFE2_OPERATORS_INT8_RESHAPE_OP_H_ 2 #define CAFFE2_OPERATORS_INT8_RESHAPE_OP_H_ 4 #include "caffe2/core/context.h" 5 #include "caffe2/core/operator.h" 6 #include "caffe2/core/tensor_int8.h" 7 #include "caffe2/operators/quantized/int8_utils.h" 8 #include "caffe2/operators/reshape_op.h" 16 template <
class... Args>
18 :
ReshapeOp(std::forward<Args>(args)...) {}
20 bool RunOnDevice()
override {
21 if (InputSize() == 2) {
26 return this->
template DoRunWithType<int64_t>();
30 bool DoRunWithType() {
33 int32_t Y_offset = this->
template GetSingleArgument<int>(
"Y_zero_point", 0);
34 auto Y_scale = this->
template GetSingleArgument<float>(
"Y_scale", 1);
35 CHECK_EQ(Y_offset, X.zero_point);
36 CHECK_EQ(Y_scale, X.scale);
38 Y->zero_point = Y_offset;
39 DoRunWithTypeImpl<T>(X.t, &Y->t);
48 #endif // CAFFE2_OPERATORS_INT8_RESHAPE_OP_H_
const Tensor & Input(int idx, DeviceType type=CPUContext::GetDeviceType())
Retrieve a non-owning reference to the input at position 'idx' for this operator. ...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
bool HasArgument(const string &name) const
Checks if the operator has an argument of the given name.