cumsum cpu kernel codedex

This commit is contained in:
shaoxiangdong 2021-04-26 17:14:36 +08:00
parent 888f5b8317
commit aee56173c4
1 changed files with 6 additions and 2 deletions

View File

@ -222,9 +222,13 @@ void CumSumCPUKernel::LaunchKernel(const std::vector<kernel::AddressPtr> &inputs
std::vector<std::thread> threads;
threads.reserve(thread_num);
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;
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;
}
while (start < lens) {