[ Tensor ] allow to have inc 0 for broadcasting for raw computation
authorjijoong.moon <jijoong.moon@samsung.com>
Mon, 27 Mar 2023 04:22:49 +0000 (13:22 +0900)
committerjijoong.moon <jijoong.moon@samsung.com>
Tue, 4 Apr 2023 01:39:05 +0000 (10:39 +0900)
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 <jijoong.moon@samsung.com>
nntrainer/tensor/blas_interface.cpp

index 3c7beba..e413f38 100644 (file)
@@ -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)