Skip to content

Commit

Permalink
Remove InsertQuantDeQuantNode (#25000)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #25000

Remove deprecated insert_quantdequant pass

Test Plan:
.

Imported from OSS

Differential Revision: D17001139

fbshipit-source-id: 5ecabdff84598fe21f24ea827b615e697081ee53
  • Loading branch information
jerryzh168 authored and facebook-github-bot committed Aug 27, 2019
1 parent fbb88f5 commit b15d914
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 474 deletions.
46 changes: 0 additions & 46 deletions torch/csrc/jit/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,52 +156,6 @@ void initJITBindings(PyObject* module) {
.def(
"_jit_pass_quant_fusion",
[](std::shared_ptr<Graph>& g) { return QuantFusion(g); })
.def(
"_jit_pass_insert_quantdequant",
[](const script::Module& moduleObj,
const std::string& methodName,
py::dict& pyQParamDict) {
if (!pyQParamDict.size()) {
return;
}

auto qparam_dict = py::cast<std::unordered_map<
std::string,
std::tuple<std::string, float, int>>>(pyQParamDict);
return InsertQuantDequantNodes(moduleObj, methodName, qparam_dict);
})
.def(
"_jit_pass_insert_quantdequant_for_weight_bias",
[](const script::Module& moduleObj,
const std::string& method_name,
const std::string& param_name,
py::function pyGetQParamFunc) {
// For different static params we pass different getQParamFunc via
// same interface exposed by the quantizer.
if (param_name == std::string("weight")) {
auto getQParamFunc =
py::cast<std::function<std::tuple<std::string, float, int>(
at::Tensor)>>(pyGetQParamFunc);
InsertQuantDequantNodesForParam(
moduleObj,
method_name,
param_name,
getQParamFunc,
at::ScalarType::QInt8);
} else if (param_name == std::string("bias")) {
auto getQParamFunc =
py::cast<std::function<std::tuple<std::string, float, int>(
float, float)>>(pyGetQParamFunc);
InsertQuantDequantNodesForParam(
moduleObj,
method_name,
param_name,
getQParamFunc,
at::ScalarType::QInt32);
} else {
TORCH_CHECK(false, "Invalid Param Name");
}
})
.def(
"_jit_pass_quantlint",
[](std::shared_ptr<Graph>& g) { return QuantLinting(g); })
Expand Down
Loading

0 comments on commit b15d914

Please sign in to comment.