Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webgpu-native] Fix a few build errors on Linux #22286

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion js/node/src/session_options_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
ORT_NAPI_THROW_TYPEERROR_IF(!externalDataValue.IsArray(), options.Env(),
"Invalid argument: sessionOptions.externalData must be an array.");
auto externalData = externalDataValue.As<Napi::Array>();
std::vector<std::wstring> paths;
std::vector<std::basic_string<ORTCHAR_T>> paths;

Check warning on line 212 in js/node/src/session_options_helper.cc

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Add #include <string> for basic_string<> [build/include_what_you_use] [4] Raw Output: js/node/src/session_options_helper.cc:212: Add #include <string> for basic_string<> [build/include_what_you_use] [4]
std::vector<char*> buffs;
std::vector<size_t> sizes;

Expand All @@ -220,8 +220,13 @@
Napi::Object obj = value.As<Napi::Object>();
ORT_NAPI_THROW_TYPEERROR_IF(!obj.Has("path") || !obj.Get("path").IsString(), options.Env(),
"Invalid argument: sessionOptions.externalData value must have a 'path' property of type string in Node.js binding.");
#ifdef _WIN32
auto path = obj.Get("path").As<Napi::String>().Utf16Value();
paths.push_back(std::wstring{path.begin(), path.end()});
#else
auto path = obj.Get("path").As<Napi::String>().Utf8Value();
paths.push_back(path);
#endif
ORT_NAPI_THROW_TYPEERROR_IF(!obj.Has("data") ||
!obj.Get("data").IsBuffer() ||
!(obj.Get("data").IsTypedArray() && obj.Get("data").As<Napi::TypedArray>().TypedArrayType() == napi_uint8_array),
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/webgpu/tensor/transpose.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ONNX_OPERATOR_KERNEL_EX(
Transpose);

auto SqueezeShape(const gsl::span<const int64_t>& shape, const gsl::span<const size_t>& adjusted_perm, InlinedVector<int64_t>& new_shape, InlinedVector<int64_t>& new_perm) {
for (auto i = 0; i < shape.size(); ++i) {
for (size_t i = 0; i < shape.size(); ++i) {
if (shape[i] != 1) {
new_shape.push_back(shape[i]);
}
Expand Down
Loading