[WebNN EP] Remove workaround for dynamic shape (#17644)

As now we have the FreeDimensionOverrides option to support dynamic
shape, we can remove the previous
workaround.
This commit is contained in:
Wanming Lin 2023-09-23 07:06:04 +08:00 committed by GitHub
parent e70a23f8dc
commit ce287a4e77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -53,9 +53,12 @@ bool IsInputSupported(const NodeArg& input, const std::string& parent_name, cons
}
for (const auto& dim : shape_proto->dim()) {
// For now we workaround dynamic shape support by assuming 1.
// WebNN doesn't support dynamic shape - use sessionOptions.freeDimensionOverrides to fix the shape.
if (!dim.has_dim_value()) {
LOGS(logger, VERBOSE) << "Dynamic shape is not supported for now, assume to be 1, for input:" << input_name;
LOGS(logger, VERBOSE) << "Dynamic shape is not supported, "
<< "use sessionOptions.FreeDimensionOverrides to set a fixed shape for input: "
<< input_name;
return false;
}
}

View file

@ -218,12 +218,9 @@ Status ModelBuilder::RegisterModelInputOutput(const NodeArg& node_arg, bool is_i
} else {
dims.reserve(shape.size());
for (const auto& dim : shape) {
if (!dim.has_dim_value()) {
// FIXME: support dyanmic shape.
dims.push_back(1);
} else {
dims.push_back(SafeInt<int32_t>(dim.dim_value()));
}
// dim_param free dimensions should have already been excluded by IsInputSupported().
assert(dim.has_dim_value());
dims.push_back(SafeInt<int32_t>(dim.dim_value()));
}
}
}