Skip to content

Commit 63e5911

Browse files
committed
Build issues
1 parent 1248aa2 commit 63e5911

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

onnxruntime/core/providers/webnn/builders/impl/resize_op_builder.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ResizeOpBuilder : public BaseOpBuilder {
3939
};
4040

4141
// Helper functions
42-
bool GetResizeScalesAndAxes(const InitializedTensorSet& initializers,
42+
bool GetResizeScalesAndAxes(const GraphViewer& graph_viewer,
4343
const Node& node, std::vector<float>& scales,
4444
std::vector<int64_t>& axes, const bool is_nhwc,
4545
const logging::Logger& logger) {
@@ -48,13 +48,14 @@ bool GetResizeScalesAndAxes(const InitializedTensorSet& initializers,
4848
return false;
4949

5050
const bool has_axes = !axes.empty();
51-
const auto& scales_tensor = *initializers.at(input_defs[2]->Name());
52-
if (scales_tensor.dims_size() != 1) {
53-
LOGS(logger, ERROR) << "'scales' should be a 1D tensor.";
51+
const auto* scales_init = graph_viewer.GetConstantInitializer(input_defs[2]->Name());
52+
if (!scales_init || scales_init->dims_size() != 1) {
53+
LOGS(logger, ERROR) << "Expecting 'scales' as a 1D constant initialized tensor.";
5454
return false;
5555
}
5656

5757
// Number of elements of 'scales' tensor.
58+
const auto& scales_tensor = *scales_init;
5859
const auto num_of_scales = scales_tensor.dims()[0];
5960

6061
if (has_axes && num_of_scales != 2) {
@@ -122,7 +123,7 @@ bool GetResizeSizesAndAxes(const GraphViewer& graph_viewer,
122123
return false;
123124
}
124125

125-
const auto& sizes_tensor = *size_init;
126+
const auto& sizes_tensor = *sizes_init;
126127
// Number of elements of sizes tensor.
127128
const auto num_of_sizes = sizes_tensor.dims()[0];
128129
if (has_axes && num_of_sizes != 2) {

0 commit comments

Comments
 (0)