Fix AddAdjustBatchOp (#16997)
authorYinghai Lu <yinghai@fb.com>
Tue, 12 Feb 2019 19:18:52 +0000 (11:18 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 12 Feb 2019 19:45:43 +0000 (11:45 -0800)
commitf2e6a3f23076617f5e18c576f6526a8a345308f8
tree7f1796ce27a89927f03499b004f110130e58638c
parent21ce1da5e9b357ccfd769e2616b9d6914ab70c83
Fix AddAdjustBatchOp (#16997)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16997

1. Don't create multiple AdjustBatch ops for the same input name. We create it once and hook input to abc_post_adjust_batch.

2. Dangling tensor. The problem for such an error is still with AttachAdjustBatchOp. Considering such as net
```
op {
  type : "Relu"
  input: "X"
  outpu: "Y"
}
op {
  type : "Relu"
  input: "Y"
  output: "Y2"
}
external_output: "Y"
external_output: "Y2"
```
In this the output of first Relu will be used as an internal node as well as output. We cannot simply rename Y into Y_pre_batch_adjust. Basically, we need another pass in to check all the input of the ops in the net and rename Y into Y_pre_batch_adjust.

Reviewed By: bertmaher

Differential Revision: D14041446

fbshipit-source-id: f6553e287a8dfb14e4044cc20afaf3f290e5151b
caffe2/opt/onnxifi_transformer.cc