forked from mindspore-Ecosystem/mindspore
!14360 fix codex warnings
From: @xutianchun Reviewed-by: @HilbertDavid,@zhanghaibo5 Signed-off-by: @HilbertDavid
This commit is contained in:
commit
fe33972027
|
@ -66,6 +66,7 @@ class DequantUtil {
|
|||
if (!channel_first) {
|
||||
if (input_tensor->shape().size() != 2) {
|
||||
MS_LOG(ERROR) << "unexpected shape size: " << input_tensor->shape().size();
|
||||
free(dequant_datas);
|
||||
return nullptr;
|
||||
}
|
||||
channels = input_tensor->shape()[1];
|
||||
|
|
|
@ -290,6 +290,7 @@ OpParameter *PopulatePoolingGradParameter(const void *primitive) {
|
|||
break;
|
||||
default:
|
||||
MS_LOG(ERROR) << "unknown pooling mode: " << poolingGrad_prim->poolingMode();
|
||||
free(pooling_param);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,9 @@ std::unique_ptr<char[]> ReadFileToBuf(const std::string &filename, size_t *size)
|
|||
return std::unique_ptr<char[]>(nullptr);
|
||||
}
|
||||
ifs.close();
|
||||
if (size) *size = fsize;
|
||||
if (size != nullptr) {
|
||||
*size = fsize;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -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_; }
|
||||
|
||||
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) {
|
||||
if (in->shape().at(mask[dim]) != out->shape().at(dim)) {
|
||||
return false;
|
||||
|
@ -85,7 +86,7 @@ int TransferSession::CompileTransferGraph() {
|
|||
}
|
||||
if (match == false && input->shape().size() == 4) {
|
||||
int nchw2nhwc_mask[4] = {0, 3, 1, 2};
|
||||
nchw2nhwc_ = CompileFormatTransform(output, input, nchw2nhwc_mask);
|
||||
nchw2nhwc_ = CompileFormatTransform(output, input, nchw2nhwc_mask, 4);
|
||||
match = nchw2nhwc_;
|
||||
}
|
||||
if (true == match) {
|
||||
|
|
|
@ -71,7 +71,7 @@ class TransferSession : public lite::TrainSession {
|
|||
bool is_valid_ = false;
|
||||
|
||||
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;
|
||||
};
|
||||
} // namespace lite
|
||||
|
|
Loading…
Reference in New Issue