Commit b088ac70 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

fixed the issue for non-standard input shape to the reshape operator

parent 4c90e9a3
...@@ -79,14 +79,15 @@ void eliminate_contiguous::apply(module& p) const ...@@ -79,14 +79,15 @@ void eliminate_contiguous::apply(module& p) const
// Make a copy so we can modify it while we iterate // Make a copy so we can modify it while we iterate
auto args = ins->inputs(); auto args = ins->inputs();
auto new_args = args;
auto mod_args = ins->module_inputs();
for(auto arg : ins->inputs()) for(auto arg : ins->inputs())
{ {
if(arg->name() == op_name) if(arg->name() == op_name)
{ {
auto new_args = args;
auto prev = arg->inputs().front(); auto prev = arg->inputs().front();
replace(new_args, arg, prev); replace(new_args, arg, prev);
if(try_compute_shape(ins, new_args, ins->module_inputs())) if(try_compute_shape(ins, new_args, mod_args))
{ {
instruction::replace_argument(ins, arg, prev); instruction::replace_argument(ins, arg, prev);
} }
......
...@@ -70,11 +70,6 @@ static literal from_repeated(shape::type_t t, const T& r) ...@@ -70,11 +70,6 @@ static literal from_repeated(shape::type_t t, const T& r)
instruction_ref onnx_parser::node_info::make_contiguous(instruction_ref ins) const instruction_ref onnx_parser::node_info::make_contiguous(instruction_ref ins) const
{ {
if(ins->get_shape().standard())
{
return ins;
}
return add_instruction(make_op("contiguous"), ins); return add_instruction(make_op("contiguous"), ins);
} }
......
...@@ -26,7 +26,6 @@ const auto& reshaper_names() ...@@ -26,7 +26,6 @@ const auto& reshaper_names()
static const std::unordered_set<std::string> names = { static const std::unordered_set<std::string> names = {
"flatten", "flatten",
"reshape", "reshape",
"contiguous",
"squeeze", "squeeze",
"unsqueeze" "unsqueeze"
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment