pytorch/caffe2/predictor
Hao Lu 4f163df41a [caffe2] Special handling of If/AsyncIf op in RemoveOpsByType (#42286)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42286

One more bug to fix. Operators such as If and AsyncIf need special treatment not just in `onnx::SsaRewrite`, but also in `RemoveOpsByType`. The solution needs two steps:
1) add external inputs/outputs of the subnets of If/AsyncIf op to the inputs/outputs of the op
2) if the inputs/outputs of the If/AsyncIf op need to be renamed as a result, the same inputs/outputs of the subnets need to be renamed as well.

I also added unit tests to cover this corner case.

Test Plan:
```
buck test //caffe2/caffe2/fb/predictor:black_box_predictor_test

mkdir /tmp/models
rm -rf /tmp/$USER/snntest
rm -rf /tmp/snntest
buck run mode/opt admarket/lib/ranking/prediction_replayer/snntest_replayer_test/tools:snntest_replay_test -- --serving_paradigm=USER_AD_PRECOMPUTATION_DSNN
```

Differential Revision: D22834028

fbshipit-source-id: c070707316cac694f452a96e5c80255abf4014bc
2020-07-30 02:02:20 -07:00
..
emulator
CMakeLists.txt
InferenceGraph.h [caffe2][redo] Reimplement RemoveOpsByType with SSA (#41606) 2020-07-17 16:06:43 -07:00
predictor.cc
predictor.h
predictor_config.cc
predictor_config.h
predictor_test.cc
predictor_utils.cc
predictor_utils.h
ThreadLocalPtr.cc
ThreadLocalPtr.h
transforms.cc [caffe2] Special handling of If/AsyncIf op in RemoveOpsByType (#42286) 2020-07-30 02:02:20 -07:00
transforms.h [caffe2][redo] Reimplement RemoveOpsByType with SSA (#41606) 2020-07-17 16:06:43 -07:00