Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test framework for operators' conversion #29

Merged
merged 6 commits into from
Apr 21, 2018

Conversation

kuke
Copy link

@kuke kuke commented Apr 19, 2018

Fix #28

Copy link
Author

@kuke kuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already implemented the unit test for conv2d, pool2d, mum_op etc, but not for batch_norm_op due to its special unit test.

@@ -24,6 +24,6 @@ unittest(){
trap 'abort' 0
set -e

unittest .
# unittest .
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit test in travis-ci is disabled because it requires the installation of caffe2, as the backend of ONNX.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, seems caffe2 backend is necessary, let me try to add the dependencies in the CI.

Copy link
Author

@kuke kuke Apr 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkuyym the installation of caffe2 always failed in local machine, and seems that it is very sensitive to the dependencies, e.g. version of cmake, protobuf etc. You can find if there is a robust way, so that we can integrate it in CI. Thanks!

'use_mkldnn': self.use_mkldnn
}

output = np.zeros((1, 1, 1, 1))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output is a placeholder, and can be any shape and any value.


self.inputs = {'Input': input, 'Filter': filter}

self.persistable = ['Filter']
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list of persistable vars, usually indicating the parameters

@varunarora
Copy link
Collaborator

Really enjoying this PR... comments coming soon..

@varunarora
Copy link
Collaborator

There's a lot of good things going on here. Before I proceed, have you considered adding check_node also in the opTest? https://github.com/onnx/onnx/blob/87ab3efad37614a96082fca54c543e9e19f8402e/onnx/checker.py

@kuke
Copy link
Author

kuke commented Apr 20, 2018

@varunarora of course. Done adding check_node, you can continue to review. Thanks!

Copy link
Collaborator

@varunarora varunarora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment, but apart from that, this looks great!

for name, np_value in self.inputs[var_name]:
tensor = core.LoDTensor()
if isinstance(np_value, tuple):
tensor.set(np_value[0], place)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to make new function for this code that repeats twice doing the .sets

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is true. I will fix it in next pull request.

@kuke
Copy link
Author

kuke commented Apr 21, 2018

@varunarora I saw the comments you added and learn a lot from them. This is a good practice. Many thanks!

@kuke kuke merged commit 0c8158d into PaddlePaddle:develop Apr 21, 2018
Zeref996 pushed a commit to Zeref996/Paddle2ONNX that referenced this pull request Aug 24, 2021
* add base test case

* add run script

* update

* add pytest configruation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants