| 238 | */ |
| 239 | template <typename T> |
| 240 | void scale(SimpleTensor<T> &tensor, T scaling_factor) |
| 241 | { |
| 242 | const int total_elements = tensor.num_elements() * tensor.num_channels(); |
| 243 | T *data_ptr = tensor.data(); |
| 244 | #if defined(_OPENMP) |
| 245 | #pragma omp parallel for |
| 246 | #endif /* _OPENMP */ |
| 247 | for (int i = 0; i < total_elements; ++i) |
| 248 | { |
| 249 | data_ptr[i] /= scaling_factor; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | /** Performs a complex element-wise multiplication with reduction across the channels axis. |
| 254 | * |
no test coverage detected