From: Xiaomeng Yang Date: Thu, 14 Mar 2019 20:48:13 +0000 (-0700) Subject: Temp fix for TileOp backward compatibility (#18026) X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~808 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9506779a7397865fa80b5ba323b57f416c503d9f;p=platform%2Fupstream%2Fpytorch.git Temp fix for TileOp backward compatibility (#18026) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18026 Temp fix for TileOp backward compatibility Reviewed By: kittipatv Differential Revision: D14463672 fbshipit-source-id: 1f3ec550245cb63f1bc4f26196b9334cfe5d0705 --- diff --git a/caffe2/operators/tile_op.cc b/caffe2/operators/tile_op.cc index 11d096e..56c858a 100644 --- a/caffe2/operators/tile_op.cc +++ b/caffe2/operators/tile_op.cc @@ -24,6 +24,15 @@ bool TileOp::DoRunWithType() { Input(1).dim() == 1 && Input(1).numel() == 1, "Input `tiles` should be a vector of size 1."); tiles_ = GetArgFromTensor(Input(1)); + + // Because of a bug in original code, temporarily adds this part to keep + // backward compatibility. + // TODO(yangxm): Remove this part when prod runtime upgraded with fixed + // model config. + if (Input(1).IsType()) { + axis_ = 0; + } + if (InputSize() > 2) { CAFFE_ENFORCE( Input(2).dim() == 1 && Input(2).numel() == 1, diff --git a/caffe2/operators/tile_op.h b/caffe2/operators/tile_op.h index 71f0bde..ad0b924 100644 --- a/caffe2/operators/tile_op.h +++ b/caffe2/operators/tile_op.h @@ -45,6 +45,15 @@ class TileOp final : public Operator { Input(1).dim() == 1 && Input(1).numel() == 1, "Input `tiles` should be a vector of size 1."); tiles_ = GetArgFromTensor(Input(1)); + + // Because of a bug in original code, temporarily adds this part to keep + // backward compatibility. + // TODO(yangxm): Remove this part when prod runtime upgraded with fixed + // model config. + if (Input(1).template IsType()) { + axis_ = 0; + } + if (InputSize() > 2) { CAFFE_ENFORCE( Input(2).dim() == 1 && Input(2).numel() == 1,