Skip to content

Commit f17b11a

Browse files
authored
Fix return type mismatch in choose_qparams_tensor_out
This fix addresses the undefined symbol error for torch::executor::native::choose_qparams_tensor_out when building on native Windows. The root cause is a mismatch between the return types in the function declaration (std::tuple<Tensor &, Tensor &>) and the function definition (std::tuple<Tensor, Tensor>). Additionally, the function definition cannot see the function declaration, so the compiler cannot catch the issue. While the Linux linker seems to handle the return type mismatch, the Windows linker reports an undefined symbol. This fix updates the return type in the function definition to match the function declaration. If possible, it would be beneficial to include the header of the function declaration so that the issue can be caught at compile time.
1 parent 5477369 commit f17b11a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernels/quantized/cpu/op_choose_qparams.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void choose_qparams(
149149
}
150150
} // namespace
151151

152-
std::tuple<Tensor, Tensor> choose_qparams_tensor_out(
152+
std::tuple<Tensor&, Tensor&> choose_qparams_tensor_out(
153153
const Tensor& input,
154154
int64_t quant_min,
155155
int64_t quant_max,
@@ -164,7 +164,7 @@ std::tuple<Tensor, Tensor> choose_qparams_tensor_out(
164164
return {scale_out, zero_point_out};
165165
}
166166

167-
::std::tuple<Tensor, Tensor> choose_qparams_tensor_out(
167+
::std::tuple<Tensor&, Tensor&> choose_qparams_tensor_out(
168168
RuntimeContext& context,
169169
const Tensor& input,
170170
int64_t quant_min,

0 commit comments

Comments
 (0)