Browse Source

fix codex warining

pull/14360/head
xutianchun 4 years ago
parent
commit
0ef7e1cfa2
5 changed files with 9 additions and 4 deletions
  1. +1
    -0
      mindspore/lite/src/dequant.h
  2. +1
    -0
      mindspore/lite/src/train/train_populate_parameter_v0.cc
  3. +3
    -1
      mindspore/lite/src/train/train_session.cc
  4. +3
    -2
      mindspore/lite/src/train/transfer_session.cc
  5. +1
    -1
      mindspore/lite/src/train/transfer_session.h

+ 1
- 0
mindspore/lite/src/dequant.h View File

@@ -66,6 +66,7 @@ class DequantUtil {
if (!channel_first) { if (!channel_first) {
if (input_tensor->shape().size() != 2) { if (input_tensor->shape().size() != 2) {
MS_LOG(ERROR) << "unexpected shape size: " << input_tensor->shape().size(); MS_LOG(ERROR) << "unexpected shape size: " << input_tensor->shape().size();
free(dequant_datas);
return nullptr; return nullptr;
} }
channels = input_tensor->shape()[1]; channels = input_tensor->shape()[1];


+ 1
- 0
mindspore/lite/src/train/train_populate_parameter_v0.cc View File

@@ -290,6 +290,7 @@ OpParameter *PopulatePoolingGradParameter(const void *primitive) {
break; break;
default: default:
MS_LOG(ERROR) << "unknown pooling mode: " << poolingGrad_prim->poolingMode(); MS_LOG(ERROR) << "unknown pooling mode: " << poolingGrad_prim->poolingMode();
free(pooling_param);
return nullptr; return nullptr;
} }




+ 3
- 1
mindspore/lite/src/train/train_session.cc View File

@@ -74,7 +74,9 @@ std::unique_ptr<char[]> ReadFileToBuf(const std::string &filename, size_t *size)
return std::unique_ptr<char[]>(nullptr); return std::unique_ptr<char[]>(nullptr);
} }
ifs.close(); ifs.close();
if (size) *size = fsize;
if (size != nullptr) {
*size = fsize;
}
return buf; return buf;
} }




+ 3
- 2
mindspore/lite/src/train/transfer_session.cc View File

@@ -55,7 +55,8 @@ TransferSession::TransferSession(const char *model_buf_backbone, size_t size_bac


std::vector<tensor::MSTensor *> TransferSession::GetInputs() const { return combined_inputs_; } std::vector<tensor::MSTensor *> TransferSession::GetInputs() const { return combined_inputs_; }


bool TransferSession::CompileFormatTransform(tensor::MSTensor *out, tensor::MSTensor *in, int *mask) {
bool TransferSession::CompileFormatTransform(tensor::MSTensor *out, tensor::MSTensor *in, int *mask, size_t mask_len) {
MS_ASSERT(out->shape().size() == mask_len);
for (std::size_t dim = 0; dim != out->shape().size(); ++dim) { for (std::size_t dim = 0; dim != out->shape().size(); ++dim) {
if (in->shape().at(mask[dim]) != out->shape().at(dim)) { if (in->shape().at(mask[dim]) != out->shape().at(dim)) {
return false; return false;
@@ -85,7 +86,7 @@ int TransferSession::CompileTransferGraph() {
} }
if (match == false && input->shape().size() == 4) { if (match == false && input->shape().size() == 4) {
int nchw2nhwc_mask[4] = {0, 3, 1, 2}; int nchw2nhwc_mask[4] = {0, 3, 1, 2};
nchw2nhwc_ = CompileFormatTransform(output, input, nchw2nhwc_mask);
nchw2nhwc_ = CompileFormatTransform(output, input, nchw2nhwc_mask, 4);
match = nchw2nhwc_; match = nchw2nhwc_;
} }
if (true == match) { if (true == match) {


+ 1
- 1
mindspore/lite/src/train/transfer_session.h View File

@@ -71,7 +71,7 @@ class TransferSession : public lite::TrainSession {
bool is_valid_ = false; bool is_valid_ = false;


private: private:
bool CompileFormatTransform(tensor::MSTensor *out, tensor::MSTensor *in, int *mask);
bool CompileFormatTransform(tensor::MSTensor *out, tensor::MSTensor *in, int *mask, size_t mask_len);
bool nchw2nhwc_ = false; bool nchw2nhwc_ = false;
}; };
} // namespace lite } // namespace lite


Loading…
Cancel
Save