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 Fix typos, via a Levenshtein-type corrector (#31523) 2020-01-17 16:03:19 -08:00
CMakeLists.txt Back out "Open-source ThreadSafeActivationCleaningPredictor" 2018-09-19 21:26:51 -07:00
InferenceGraph.h [caffe2][redo] Reimplement RemoveOpsByType with SSA (#41606) 2020-07-17 16:06:43 -07:00
predictor_config.cc Make C10_MOBILE consistent with how feature macros are usually used (#17481) 2019-02-27 17:57:51 -08:00
predictor_config.h Removing cyclic dependency (#20511) 2019-05-14 18:55:19 -07:00
predictor_test.cc Replace c10::guts::stuff with std::stuff (#30915) 2019-12-16 13:57:19 -08:00
predictor_utils.cc Replace c10::guts::stuff with std::stuff (#30915) 2019-12-16 13:57:19 -08:00
predictor_utils.h Back out "[caffe2] Update blackbox predictor with new constructor" (#11105) 2018-08-31 00:55:36 -07:00
predictor.cc Removing cyclic dependency (#20511) 2019-05-14 18:55:19 -07:00
predictor.h Make predictor base class 2019-02-01 20:59:19 -08:00
ThreadLocalPtr.cc BlackBoxPredictor OSS part N: ThreadLocalPtr, InferenceGraph (#23257) 2019-07-24 14:35:30 -07:00
ThreadLocalPtr.h BlackBoxPredictor OSS part N: ThreadLocalPtr, InferenceGraph (#23257) 2019-07-24 14:35:30 -07:00
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