onnx-fb-universe icon indicating copy to clipboard operation
onnx-fb-universe copied to clipboard

[Do NOT Merge] Test aten export and execution

Open houseroad opened this issue 7 years ago • 3 comments

This is for testing, please don't merge.

To run it, please build your Caffe2 with -DUSE_ATEN=ON

houseroad avatar Dec 16 '17 01:12 houseroad

python test/test_caffe2.py -v TestCaffe2BackendATen.test_alexnet

houseroad avatar Dec 16 '17 01:12 houseroad

The segfault is caused by calling at::Tensor::addmm in caffe2 get resolved to the one in pytorch (even ATen is statically linked in Caffe2), the reason is this ends up being a weak symbol in caffe2's pybind_state .so file (I guess it's because this is template function), and so will be resolved to the earlier imported .so file that has this symbol (since we currently import pytorch first in the test_caffe2.py). Switching the import order (i.e. putting caffe2 related import at the top) can solve this in my local environment, although theoretically it should have the same issue (but opposite direction) (@ezyang Does pytorch invoke the ATen function when doing export?). Let's use this for now and wait for the proper solution that will come in the next pytorch release.

bddppq avatar Dec 16 '17 08:12 bddppq

There are some real test failures now

test_constant (__main__.TestCaffe2Backend) ... terminate called after throwing an instance of 'std::runtime_error'
  what():  localScalar() called on undefined Tensor

bddppq avatar Dec 16 '17 08:12 bddppq