diff options
author | Lu Fang <lufang@fb.com> | 2019-04-08 16:01:30 -0700 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-04-08 16:06:00 -0700 |
commit | 443a58e03d00fa04a429ab625c1fc7e3a7e4d529 (patch) | |
tree | fa8e7bbe1a66fba3d5e086bd9439cada437b7b15 /aten | |
parent | 09c19e10682884efe8433ea06009de589a5b4183 (diff) | |
download | pytorch-443a58e03d00fa04a429ab625c1fc7e3a7e4d529.tar.gz pytorch-443a58e03d00fa04a429ab625c1fc7e3a7e4d529.tar.bz2 pytorch-443a58e03d00fa04a429ab625c1fc7e3a7e4d529.zip |
Export C10 operator in PyTorch Model (#18210)
Summary:
Almost there, feel free to review.
these c10 operators are exported to _caffe2 domain.
TODO:
- [x] let the onnx checker pass
- [x] test tensor list as argument
- [x] test caffe2 backend and converter
- [x] check the c10 schema can be exported to onnx
- [x] refactor the test case to share some code
- [x] fix the problem in ONNX_ATEN_FALLBACK
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18210
Reviewed By: zrphercule
Differential Revision: D14600916
Pulled By: houseroad
fbshipit-source-id: 2592a75f21098fb6ceb38c5d00ee40e9e01cd144
Diffstat (limited to 'aten')
-rw-r--r-- | aten/src/ATen/core/interned_strings.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/aten/src/ATen/core/interned_strings.h b/aten/src/ATen/core/interned_strings.h index dd0fd18b34..7e3e8ea95a 100644 --- a/aten/src/ATen/core/interned_strings.h +++ b/aten/src/ATen/core/interned_strings.h @@ -18,6 +18,7 @@ namespace c10 { _(namespaces, attr) \ _(namespaces, scope) \ _(namespaces, user) \ + _(namespaces, _caffe2) \ _(namespaces, namespaces) \ _(prim, Assign) \ _(prim, BroadcastingChunk) \ @@ -188,6 +189,7 @@ namespace c10 { _(namespaces, attr) \ _(namespaces, scope) \ _(namespaces, user) \ + _(namespaces, _caffe2) \ _(namespaces, namespaces) #endif @@ -255,6 +257,7 @@ struct CAFFE2_API Symbol { static Symbol onnx(const std::string & s); static Symbol prim(const std::string & s); static Symbol user(const std::string & s); + static Symbol caffe2(const std::string & s); // TODO: eliminate me static Symbol scope(const std::string & s); @@ -263,6 +266,7 @@ struct CAFFE2_API Symbol { bool is_prim() const; bool is_onnx() const; bool is_user() const; + bool is_caffe2() const; // So we can switch on this constexpr operator unique_t() const { @@ -322,11 +326,13 @@ inline Symbol Symbol::onnx(const std::string & s) { return Symbol::fromQualStri inline Symbol Symbol::prim(const std::string & s) { return Symbol::fromQualString("prim::" + s); } inline Symbol Symbol::scope(const std::string & s) { return Symbol::fromQualString("scope::" + s); } inline Symbol Symbol::user(const std::string & s) { return Symbol::fromQualString("user::" + s); } +inline Symbol Symbol::caffe2(const std::string & s) { return Symbol::fromQualString("_caffe2::" + s); } inline bool Symbol::is_attr() const { return ns() == namespaces::attr; } inline bool Symbol::is_aten() const { return ns() == namespaces::aten; } inline bool Symbol::is_prim() const { return ns() == namespaces::prim; } inline bool Symbol::is_onnx() const { return ns() == namespaces::onnx; } inline bool Symbol::is_user() const { return ns() == namespaces::user; } +inline bool Symbol::is_caffe2() const { return ns() == namespaces::_caffe2; } } // namespace c10 |