!13516 [MSLITE][Develop] fix bug of fp32 grad op: unsorted_segmaent_sum

From: @yangruoqi713
Reviewed-by: @zhang_xue_tong,@hangangqiang
Signed-off-by: @zhang_xue_tong
This commit is contained in:
mindspore-ci-bot 2021-03-18 14:25:20 +08:00 committed by Gitee
commit f17689b39f
2 changed files with 7 additions and 4 deletions

View File

@ -38,6 +38,8 @@ int UnsortedSegmentSumCPUKernel::Init() {
auto input_shape = in_tensors_.at(0)->shape();
auto segment_ids_shape = in_tensors_.at(1)->shape();
auto output_shape = out_tensors_.at(0)->shape();
unit_num_ = 1;
input_dim1_ = 1;
for (size_t i = 0; i < input_shape.size(); ++i) {
unit_num_ *= input_shape[i];
if (i >= segment_ids_shape.size()) {
@ -45,6 +47,7 @@ int UnsortedSegmentSumCPUKernel::Init() {
}
}
output_dim0_ = output_shape[0];
output_dim1_ = 1;
for (size_t j = 1; j < output_shape.size(); j++) {
output_dim1_ *= output_shape[j];
}

View File

@ -32,10 +32,10 @@ class UnsortedSegmentSumCPUKernel : public LiteKernel {
int ReSize() override;
int Run() override;
int Execute(int task_id);
size_t unit_num_;
size_t input_dim1_;
size_t output_dim0_;
size_t output_dim1_;
size_t unit_num_ = 0;
size_t input_dim1_ = 0;
size_t output_dim0_ = 0;
size_t output_dim1_ = 0;
private:
};