Browse Source

cumsum cpu kernel codedex

pull/15708/head
shaoxiangdong 4 years ago
parent
commit
aee56173c4
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      mindspore/ccsrc/backend/kernel_compiler/cpu/cumsum_cpu_kernel.cc

+ 6
- 2
mindspore/ccsrc/backend/kernel_compiler/cpu/cumsum_cpu_kernel.cc View File

@@ -222,9 +222,13 @@ void CumSumCPUKernel::LaunchKernel(const std::vector<kernel::AddressPtr> &inputs
std::vector<std::thread> threads; std::vector<std::thread> threads;
threads.reserve(thread_num); threads.reserve(thread_num);
size_t start = 0; size_t start = 0;
if (thread_num < 1) {
MS_LOG(ERROR) << "Invalid value: thread_num " << thread_num;
return;
}
size_t once_compute_size = (lens + thread_num - 1) / thread_num; size_t once_compute_size = (lens + thread_num - 1) / thread_num;
if (thread_num < 1 || once_compute_size < 1) {
MS_LOG(ERROR) << "Invalid value: thread_num " << thread_num << "; once_compute_size " << once_compute_size;
if (once_compute_size < 1) {
MS_LOG(ERROR) << "Invalid value: once_compute_size " << once_compute_size;
return; return;
} }
while (start < lens) { while (start < lens) {


Loading…
Cancel
Save