@@ -39,7 +39,7 @@ class ResizeOpBuilder : public BaseOpBuilder {
39
39
};
40
40
41
41
// Helper functions
42
- bool GetResizeScalesAndAxes (const InitializedTensorSet& initializers ,
42
+ bool GetResizeScalesAndAxes (const GraphViewer& graph_viewer ,
43
43
const Node& node, std::vector<float >& scales,
44
44
std::vector<int64_t >& axes, const bool is_nhwc,
45
45
const logging::Logger& logger) {
@@ -48,13 +48,14 @@ bool GetResizeScalesAndAxes(const InitializedTensorSet& initializers,
48
48
return false ;
49
49
50
50
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." ;
54
54
return false ;
55
55
}
56
56
57
57
// Number of elements of 'scales' tensor.
58
+ const auto & scales_tensor = *scales_init;
58
59
const auto num_of_scales = scales_tensor.dims ()[0 ];
59
60
60
61
if (has_axes && num_of_scales != 2 ) {
@@ -122,7 +123,7 @@ bool GetResizeSizesAndAxes(const GraphViewer& graph_viewer,
122
123
return false ;
123
124
}
124
125
125
- const auto & sizes_tensor = *size_init ;
126
+ const auto & sizes_tensor = *sizes_init ;
126
127
// Number of elements of sizes tensor.
127
128
const auto num_of_sizes = sizes_tensor.dims ()[0 ];
128
129
if (has_axes && num_of_sizes != 2 ) {
0 commit comments