reduce_arithmetic_memory

pull/12921/head
sunsuodong 4 years ago
parent a26496e413
commit 9044a4268c

@ -16,7 +16,6 @@
#include "nnacl/fp32/conv_common_fp32.h"
#include <string.h>
#include "nnacl/fp32/common_func_fp32.h"
#include "nnacl/fp32/matmul_fp32.h"
// fp32 conv common

@ -111,6 +111,16 @@ int CastFp16CPUKernel::DoCast(int thread_id) {
MS_LOG(ERROR) << "Unsupported output data type " << output_data_type;
return RET_ERROR;
}
} else if (input_data_type == kNumberTypeInt32) {
switch (output_data_type) {
case kNumberTypeFloat32:
Int32ToFloat32(static_cast<int32_t *>(input->data_c()) + offset, static_cast<float *>(output_data) + offset,
data_num);
break;
default:
MS_LOG(ERROR) << "Unsupported output data type " << output_data_type;
return RET_ERROR;
}
} else {
MS_LOG(ERROR) << "Unsupported input data type " << input_data_type;
return RET_ERROR;

@ -91,8 +91,7 @@ int ArithmeticCPUKernel::ConstTensorBroadCast() {
param_->in_elements_num1_ != param_->out_elements_num_) {
return RET_OK;
}
if ((param_->in_elements_num0_ == 1 || param_->in_elements_num1_ == 1) &&
(arithmetic_opt_run_ != nullptr && arithmetic_opt_run_int_ != nullptr)) {
if ((param_->in_elements_num0_ == 1 || param_->in_elements_num1_ == 1) && arithmetic_opt_run_ != nullptr) {
/* run opt function
* one of input is scalar */
return RET_OK;
@ -327,8 +326,7 @@ int ArithmeticCPUKernel::DoArithmetic(int task_id) {
}
int offset = stride * task_id * data_type_len_;
/* run opt function, one of input is scalar */
if ((param_->in_elements_num0_ == 1 || param_->in_elements_num1_ == 1) &&
(arithmetic_opt_run_ != nullptr && arithmetic_opt_run_int_ != nullptr)) {
if ((param_->in_elements_num0_ == 1 || param_->in_elements_num1_ == 1) && arithmetic_opt_run_ != nullptr) {
if (param_->in_elements_num0_ == 1) {
return Execute(input0_ptr_, static_cast<uint8_t *>(input1_ptr_) + offset,
static_cast<uint8_t *>(output_ptr_) + offset, count, true);

@ -38,7 +38,7 @@ class BatchToSpaceCPUKernel : public LiteKernel {
private:
int32_t block_shape_[BATCH_TO_SPACE_BLOCK_SHAPE_SIZE];
int32_t crops_[COMM_SHAPE_SIZE];
bool no_crop_;
bool no_crop_ = false;
};
} // namespace mindspore::kernel

Loading…
Cancel
Save