Skip to content

Commit ddd4581

Browse files
Yinghai Lufacebook-github-bot
authored andcommitted
More code fakefp16 mapping unification
Summary: ATT Reviewed By: amylittleyang Differential Revision: D19597036 fbshipit-source-id: deed61945884fb4b01d058f3c72c75f5a937a41c
1 parent bdbd521 commit ddd4581

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

caffe2/opt/custom/fakefp16_transform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace caffe2 {
1212
namespace opt {
1313

1414
// Mapping from fp32 ops to fakefp16 ops
15-
std::unordered_map<std::string, std::string> getFakeFp16OpMapping(
15+
CAFFE2_API std::unordered_map<std::string, std::string> getFakeFp16OpMapping(
1616
bool use_fp16_acc = false,
1717
bool use_nnpi = false);
1818

caffe2/python/pybind_state.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "caffe2/onnx/helper.h"
2222
#include "caffe2/onnx/onnx_exporter.h"
2323
#include "caffe2/opt/converter.h"
24+
#include "caffe2/opt/custom/fakefp16_transform.h"
2425
#include "caffe2/opt/fusion.h"
2526
#include "caffe2/opt/mobile.h"
2627
#include "caffe2/opt/onnxifi_transformer.h"
@@ -1706,6 +1707,9 @@ void addGlobalMethods(py::module& m) {
17061707
new_proto.SerializeToString(&out);
17071708
return py::bytes(out);
17081709
});
1710+
m.def("get_fakefp16_mapping", [](bool use_fp16_acc, bool use_nnpi) {
1711+
return caffe2::opt::getFakeFp16OpMapping(use_fp16_acc, use_nnpi);
1712+
});
17091713
m.def(
17101714
"onnxifi",
17111715
[](const py::bytes& pred_net_str,

0 commit comments

Comments
 (0)