De-dup beam search state reshape shape blob
De-dup beam search state reshape shape blob

Summary:
T22119644 showed that there is a potential illegal memory access in beam search with attention. Upon further inspection, we can see that there are multiple ops that write to the same old shape blob:

  {"output0": "model0/attention_decoder/attention_weighted_encoder_context_reshaped", "output1": "state_old_shape_before_choosing_per_hypo", "input0": "model0/attention_decoder/attention_weighted_encoder_context" }},
  {"output0": "model0/attention_decoder/hidden_t_external_reshaped", "output1": "state_old_shape_before_choosing_per_hypo", "input0": "model0/attention_decoder/hidden_t_external" }},
  {"output0": "model0/decoder/layer0/cell_t_reshaped", "output1": "state_old_shape_before_choosing_per_hypo", "input0": "model0/decoder/layer0/cell_t" }},

This diff de-dupes these outputs

Reviewed By: akyrola

Differential Revision: D5899103

fbshipit-source-id: 8b6f3f113e764dfeb9262f6c442e1124559cd2d8

sf-wind/caffe2,pietern/caffe2,xzturn/caffe2,pietern/caffe2,davinwang/caffe2,sf-wind/caffe2,xzturn/caffe2,Yangqing/caffe2,sf-wind/caffe2,Yangqing/caffe2,davinwang/caffe2,sf-wind/caffe2,xzturn/caffe2,pietern/caffe2,pietern/caffe2,xzturn/caffe2,davinwang/caffe2,Yangqing/caffe2,davinwang/caffe2,davinwang/caffe2,pietern/caffe2,caffe2/caffe2,Yangqing/caffe2,sf-wind/caffe2,Yangqing/caffe2,xzturn/caffe2