From 9d78b1d414f17b5623e9de461868ffa764a68a81 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 30 Nov 2022 14:42:03 +0800 Subject: [PATCH] [Other] Fix compile error on linux aarch64 (#752) Fix compile error on linux aarch64 --- fastdeploy/function/sort.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fastdeploy/function/sort.cc b/fastdeploy/function/sort.cc index 23f66b8086..5b81a631cb 100644 --- a/fastdeploy/function/sort.cc +++ b/fastdeploy/function/sort.cc @@ -73,8 +73,9 @@ void SortKernel(const FDTensor& x, FDTensor* out, FDTensor* indices, axis = (axis < 0) ? (rank + axis) : axis; // Do full sort if (axis == -1 || axis + 1 == rank) { - const int64_t input_width = input_shape[rank - 1]; - const int64_t input_height = x.Numel() / input_width; + int64_t numel = x.Numel(); + int64_t input_width = input_shape[axis]; + int64_t input_height = numel / input_width; FD_VISIT_INT_TYPES(indices_type, "FullSort", ([&] { FullSort(input_height, input_width, rank, &x, out, indices, descending); @@ -93,8 +94,9 @@ void SortKernel(const FDTensor& x, FDTensor* out, FDTensor* indices, FDTensor trans_inp; Transpose(x, &trans_inp, trans); - const int64_t input_width = input_shape[axis]; - const int64_t input_height = x.Numel() / input_width; + int64_t numel = x.Numel(); + int64_t input_width = input_shape[axis]; + int64_t input_height = numel / input_width; FD_VISIT_INT_TYPES(indices_type, "FullSort", ([&] { FullSort(input_height, input_width, rank, &trans_inp, out, indices, @@ -115,4 +117,4 @@ void Sort(const FDTensor& x, FDTensor* out, FDTensor* indices, int axis, } } // namespace function -} // namespace fastdeploy \ No newline at end of file +} // namespace fastdeploy