forked from mindspore-Ecosystem/mindspore
!33990 [MS][LITE] fix GetOptimizerParams and assign op bug
Merge pull request !33990 from jianghui58/train_0505
This commit is contained in:
commit
bda906f92a
|
@ -36,12 +36,12 @@ int AssignCPUKernel::DoExecute(int task_id) {
|
||||||
CHECK_NULL_RETURN(y);
|
CHECK_NULL_RETURN(y);
|
||||||
int length = in_tensors_.at(0)->ElementsNum();
|
int length = in_tensors_.at(0)->ElementsNum();
|
||||||
int stride = UP_DIV(length, thread_count_);
|
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;
|
int start = stride * task_id;
|
||||||
|
|
||||||
if (count > 0) {
|
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;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ class OptimizerKernel : public LiteKernel {
|
||||||
indices.push_back(lr_idx_);
|
indices.push_back(lr_idx_);
|
||||||
for (size_t ix = 0; ix < indices.size(); ix++) {
|
for (size_t ix = 0; ix < indices.size(); ix++) {
|
||||||
auto param = in_tensors_.at(indices[ix]);
|
auto param = in_tensors_.at(indices[ix]);
|
||||||
if (param->data() == nullptr) {
|
if (!param->IsConst()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
params.push_back(param);
|
params.push_back(param);
|
||||||
|
|
Loading…
Reference in New Issue