pytorch/caffe2/python/test
Dmytro Dzhulgakov 3af2d6d904 Enforce import order to make protobuf cpp implementation in python work (#18560)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18560

We have to import python protobuf here **before** we load cpp extension.
Otherwise it breaks under certain build conditions if cpp implementation of
protobuf is used. Presumably there's some registry in protobuf library and
python side has to initialize the dictionary first, before static
initialization in python extension does so. Otherwise, duplicated protobuf
descriptors will be created and it can lead to obscure errors like

  Parameter to MergeFrom() must be instance of same class: expected caffe2.NetDef got caffe2.NetDef.

I think it also fixes https://github.com/facebookarchive/caffe2/issues/1573

Reviewed By: ezyang, iroot900

Differential Revision: D14622054

fbshipit-source-id: 2499eb88ecdee85ff8d845859048f7ae5da2a480
2019-04-03 13:17:08 -07:00
..
__init__.py Add __init__.py so files get picked up on install (#14898) 2018-12-07 13:40:23 -08:00
blob_deallocation_test.py Fix crash in blob deallocation 2017-10-10 19:03:01 -07:00
do_op_test.py DoOp reuse workspace and test 2017-10-12 13:37:34 -07:00
executor_test_util.py Fix occasional test timeouts 2018-01-19 20:08:58 -08:00
executor_test.py Unify gpu_support variable in python tests (#16748) 2019-02-07 00:29:51 -08:00
inference_lstm_op_test.py Implement a Caffe2 standalone LSTM operator (#17726) 2019-03-07 01:08:49 -08:00
python_protobuf_test.py Enforce import order to make protobuf cpp implementation in python work (#18560) 2019-04-03 13:17:08 -07:00