!33990 [MS][LITE] fix GetOptimizerParams and assign op bug

Merge pull request !33990 from jianghui58/train_0505
This commit is contained in:
i-robot 2022-05-09 07:39:02 +00:00 committed by Gitee
commit bda906f92a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 3 deletions

View File

@ -36,12 +36,12 @@ int AssignCPUKernel::DoExecute(int task_id) {
CHECK_NULL_RETURN(y);
int length = in_tensors_.at(0)->ElementsNum();
int stride = UP_DIV(length, thread_count_);
size_t count = MSMIN(stride, length - stride * task_id);
int count = MSMIN(stride, length - stride * task_id);
int start = stride * task_id;
if (count > 0) {
memcpy(&(x[start]), &(y[start]), count * sizeof(float));
memcpy(&(x[start]), &(y[start]), static_cast<size_t>(count) * sizeof(float));
}
return RET_OK;
}

View File

@ -70,7 +70,7 @@ class OptimizerKernel : public LiteKernel {
indices.push_back(lr_idx_);
for (size_t ix = 0; ix < indices.size(); ix++) {
auto param = in_tensors_.at(indices[ix]);
if (param->data() == nullptr) {
if (!param->IsConst()) {
continue;
}
params.push_back(param);