mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/73227 Reviewed By: christycylee Differential Revision: D34016914 fbshipit-source-id: 277937f3c13a54ea1180afac253ee9927e56e99e (cherry picked from commit d97777318170a406d89755e577386cde857dd59b)
32 lines
739 B
C++
32 lines
739 B
C++
#pragma once
|
|
|
|
#include "caffe2/operators/relu_op.h"
|
|
|
|
#include "caffe2/core/tensor_int8.h"
|
|
#include "caffe2/quantization/server/caffe2_dnnlowp_utils.h"
|
|
|
|
namespace caffe2 {
|
|
|
|
template <typename T>
|
|
class ReluDNNLowPOp final : public Operator<CPUContext> {
|
|
public:
|
|
USE_OPERATOR_FUNCTIONS(CPUContext);
|
|
ReluDNNLowPOp(const OperatorDef& operator_def, Workspace* ws)
|
|
: Operator<CPUContext>(operator_def, ws),
|
|
qfactory_(dnnlowp::GetQuantizationFactoryOf(this)) {}
|
|
|
|
bool RunOnDevice() override;
|
|
|
|
private:
|
|
std::unique_ptr<dnnlowp::QuantizationFactory> qfactory_;
|
|
};
|
|
|
|
namespace internal {
|
|
|
|
template <typename T>
|
|
void ReluAVX2(const int N, const int zero_point, const T* X, T* Y);
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace caffe2
|