pytorch/caffe2/python/onnx
Yinghai Lu 8044dc4eb8 Support new Reshape semantics (#10848)
Summary:
Since ONNX opset version >5, Reshape changed semantics to take a shape tensor as input instead of relying on `shape` attribute to decide what shape to reshape to. ONNXIFI op has been postponing this change as some of the backends such as TensorRT were not ready. Now that the backends have adopted this semantics, we can remove the legacy mode and output opset version 7 ONNX models.

This change also flushes out some of the bugs and new requirement.
- Converting shape info into int64 tensor
- Fix a bug when we output the shape tensor in the mapped workspace instead of the original workspace
Pull Request resolved: https://github.com/pytorch/pytorch/pull/10848

Reviewed By: houseroad

Differential Revision: D9495121

Pulled By: yinghai

fbshipit-source-id: a6f44a89274c35b33fae9a429813ebf21d9a3d1a
2018-08-24 11:46:41 -07:00
..
bin Remove Apache headers from source. 2018-03-27 13:10:18 -07:00
tests Update the onnx Gemm op to FC/FCTransposed logic in caffe2 onnx backend (#10108) 2018-08-20 16:09:22 -07:00
__init__.py
backend.py Back out "Add aten_op to caffe2 onnx (python) backend" (#10589) 2018-08-16 15:15:27 -07:00
backend_cpp_rep.py Remove Apache headers from source. 2018-03-27 13:10:18 -07:00
backend_rep.py Disallow using the OOP api workspace as context managers (#6456) 2018-04-09 22:13:54 -07:00
error.py Remove Apache headers from source. 2018-03-27 13:10:18 -07:00
frontend.py Bump up the C2 onnx frontend opset to 8 (#9006) 2018-06-29 11:56:11 -07:00
helper.py [Caffe2] Scoped dummy name generator (#6458) 2018-04-16 11:58:02 -07:00
onnxifi.py Support new Reshape semantics (#10848) 2018-08-24 11:46:41 -07:00
ONNXOpCoverage.md Update the ONNX op coverage in C2 2018-06-29 17:25:19 -07:00
README.md Add README and ONNXOpCoverage doc back (#2102) 2018-03-01 17:05:25 -08:00
test_onnxifi.py Remove weight from input of onnxifi backend op (#10575) 2018-08-16 10:56:25 -07:00
workspace.py Disallow using the OOP api workspace as context managers (#6456) 2018-04-09 22:13:54 -07:00

Caffe2 implementation of Open Neural Network Exchange (ONNX)

Usage

Installation

onnx-caffe2 is installed as a part of Caffe2. Please follow the instructions to install Caffe2.

Folder Structure

  • ./: the main folder that all code lies under
    • frontend.py: translate from caffe2 model to onnx model
    • backend.py: execution engine that runs onnx on caffe2
  • tests/: test files

Testing

onnx-caffe2 uses pytest as test driver. In order to run tests, first you need to install pytest:

pip install pytest-cov

After installing pytest, do

pytest

to run tests.

Testing coverage issues/status: https://github.com/caffe2/caffe2/blob/master/caffe2/python/onnx/ONNXOpCoverage.md

Development

During development it's convenient to install caffe2 in development mode:

cd /path/to/caffe2
pip install -e caffe2/

License

MIT License