未验证 提交 1faae955 编写于 作者: L Liuyu198701 提交者: GitHub

Fix error in Pad op convert (#3778)

* Fix bug in pad converter, value only needed in constant mode.
Signed-off-by: NYu Liu <yu.liu@enflame-tech.com>

* Fix bug in pad converter, value only needed in constant mode or default (constant).
Signed-off-by: NYu Liu <yu.liu@enflame-tech.com>

* Fix bug in pad converter. input_rank maybe 0 and will set wrong t_pads.sizes().
Signed-off-by: NYu Liu <yu.liu@enflame-tech.com>

* Fix bug in pad converter. input_rank maybe 0 and will set wrong t_pads.sizes().
Signed-off-by: NYu Liu <yu.liu@enflame-tech.com>
Co-authored-by: NYu Liu <yu.liu@enflame-tech.com>
Co-authored-by: NG. Ramalingam <grama@microsoft.com>
上级 6af1ed14
......@@ -17,12 +17,11 @@ class Pad_10_11 final : public Adapter {
// Turn pads attribute into input
Tensor t_pads;
t_pads.elem_type() = TensorProto_DataType_INT64;
int input_rank = node->inputs()[0]->sizes().size();
t_pads.sizes() = std::vector<int64_t> {2 * input_rank};
auto& data_pads = t_pads.int64s();
for (int64_t shape : node->is(kpads)) {
data_pads.emplace_back(shape);
}
t_pads.sizes() = std::vector<int64_t> {(int64_t)data_pads.size()};
Value* v_pads = graph->addInitializerAndInput(t_pads);
node->addInput(v_pads);
node->removeAttribute(kpads);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册