Open
Description
Description
In this PR, some initializers will be stored as in-memory external data during graph transformation.
In the WebNN EP, it doesn't handle the in-memory external data, this will cause error (External mounted files are not available.
) when it tries to register such initializers (in memory external data) to WebNN constant at here.
if (utils::HasExternalData(tensor)) {
// Create WebNN Constant from external data.
std::basic_string<ORTCHAR_T> external_file_path;
onnxruntime::FileOffsetType data_offset;
SafeInt<size_t> tensor_byte_size;
ORT_RETURN_IF_ERROR(utils::GetExternalDataInfo(
tensor, graph_viewer_.ModelPath(), external_file_path, data_offset, tensor_byte_size));
auto webnnRegisterMLConstant = emscripten::val::module_property("webnnRegisterMLConstant");
operand = webnnRegisterMLConstant(emscripten::val(external_file_path),
static_cast<int32_t>(data_offset),
static_cast<int32_t>(tensor_byte_size),
wnn_builder,
desc,
should_convert_int64_to_int32);