From: jijoong.moon Date: Mon, 27 Mar 2023 04:22:49 +0000 (+0900) Subject: [ Tensor ] allow to have inc 0 for broadcasting for raw computation X-Git-Tag: accepted/tizen/8.0/unified/20231005.093407~175 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=64589a7dc919c85295387058cecf6a72ed857c80;p=platform%2Fcore%2Fml%2Fnntrainer.git [ Tensor ] allow to have inc 0 for broadcasting for raw computation This PR allows to have 0 for incX and incY in tensor raw compuation to enable broadcasting tensor operation. **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: jijoong.moon --- diff --git a/nntrainer/tensor/blas_interface.cpp b/nntrainer/tensor/blas_interface.cpp index 3c7beba..e413f38 100644 --- a/nntrainer/tensor/blas_interface.cpp +++ b/nntrainer/tensor/blas_interface.cpp @@ -34,7 +34,7 @@ namespace nntrainer { static void saxpy_raw(const unsigned int N, const float alpha, const float *X, const int incX, float *Y, const int incY) { - if (incX <= 0 or incY <= 0) + if (incX < 0 or incY < 0) throw std::invalid_argument( "Error: negative inc not supported without cblas"); for (unsigned int i = 0; i < N; ++i)