Skip to content

Commit

Permalink
Merge 0e43b15 into 9de39b1
Browse files Browse the repository at this point in the history
  • Loading branch information
QingChuanWS authored Apr 8, 2021
2 parents 9de39b1 + 0e43b15 commit 93971c2
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 640 deletions.
30 changes: 0 additions & 30 deletions docs/onnx.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,6 @@ opset_version = 11
register_extra_symbolics(opset_version)
```

## ONNX simplify

### Intention

`mmcv.onnx.simplify` is based on [onnx-simplifier](https://github.com/daquexian/onnx-simplifier), which is a useful tool to make exported ONNX models slimmer by performing a series of optimization. However, for Pytorch models with custom op from `mmcv`, it would break down. Thus, custom ops for ONNX Runtime should be registered.

### Prerequisite

`mmcv.onnx.simplify` has three dependencies: `onnx`, `onnxoptimizer`, `onnxruntime`. After installation of `mmcv`, you have to install them manually using pip.

```bash
pip install onnx onnxoptimizer onnxruntime
```

### Usage

```python
import onnx
import numpy as np

import mmcv
from mmcv.onnx.simplify import simplify

dummy_input = np.random.randn(1, 3, 224, 224).astype(np.float32)
input = {'input':dummy_input}
input_file = 'sample.onnx'
output_file = 'slim.onnx'
model = simplify(input_file, [input], output_file)
```

### FAQs

- None
3 changes: 0 additions & 3 deletions mmcv/onnx/simplify/__init__.py

This file was deleted.

43 changes: 0 additions & 43 deletions mmcv/onnx/simplify/common.py

This file was deleted.

Loading

0 comments on commit 93971c2

Please sign in to comment.