forked from OSSInnovation/mindspore
!9355 [MSLITE] fix a bug in normalize operator
From: @probiotics_53 Reviewed-by: @zhanghaibo5,@zhanghaibo5,@hangangqiang Signed-off-by: @zhanghaibo5
This commit is contained in:
commit
a3aac7bf79
|
@ -49,12 +49,13 @@ int NormalizeCPUKernel::Init() {
|
||||||
|
|
||||||
int NormalizeCPUKernel::ReSize() { return RET_OK; }
|
int NormalizeCPUKernel::ReSize() { return RET_OK; }
|
||||||
|
|
||||||
std::string NormalizeCPUKernel::Trim(const std::string &str, const std::string &whitespace /*= " \t\n\v\f\r"*/) {
|
std::string NormalizeCPUKernel::Trim(const std::string &str, const std::string &pattern /*= " \t\n\v\f\r"*/) {
|
||||||
if (str.empty()) {
|
auto begin = str.find_first_not_of(pattern);
|
||||||
|
if (begin == std::string::npos) {
|
||||||
|
MS_LOG(WARNING) << "Meaningless input string!";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
auto begin = str.find_first_not_of(whitespace);
|
auto end = str.find_last_not_of(pattern);
|
||||||
auto end = str.find_last_not_of(whitespace);
|
|
||||||
const auto range = end - begin + 1;
|
const auto range = end - begin + 1;
|
||||||
return str.substr(begin, range);
|
return str.substr(begin, range);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class NormalizeCPUKernel : public LiteKernel {
|
||||||
int Run() override;
|
int Run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string Trim(const std::string &str, const std::string &whitespace = " \t\n\v\f\r");
|
std::string Trim(const std::string &str, const std::string &pattern = " \t\n\v\f\r");
|
||||||
std::string GlobalReplace(const std::string &str, const std::string ®, const std::string &replace);
|
std::string GlobalReplace(const std::string &str, const std::string ®, const std::string &replace);
|
||||||
std::string Normalize(const std::string &str);
|
std::string Normalize(const std::string &str);
|
||||||
std::vector<char *> normalized_strs;
|
std::vector<char *> normalized_strs;
|
||||||
|
|
|
@ -15,3 +15,4 @@ mindspore_ghost-nose-pets-811.mindir 0.5
|
||||||
mindspore_ghost-pets-8244.mindir 1.5
|
mindspore_ghost-pets-8244.mindir 1.5
|
||||||
mindspore_ghostnet600M-pets.mindir 1.5
|
mindspore_ghostnet600M-pets.mindir 1.5
|
||||||
mindspore_ghostnet_1x_pets_int8.mindir 12
|
mindspore_ghostnet_1x_pets_int8.mindir 12
|
||||||
|
mindspore_deeplab_v3_s16.mindir 6.5
|
||||||
|
|
|
@ -33,3 +33,4 @@ rain-princess-9.onnx 5
|
||||||
udnie-9.onnx 3
|
udnie-9.onnx 3
|
||||||
adversarial_pruning.onnx 3
|
adversarial_pruning.onnx 3
|
||||||
residual_distill_res34_cifar10_bs_1_update.onnx 2
|
residual_distill_res34_cifar10_bs_1_update.onnx 2
|
||||||
|
residual_distill_res50_cifar10_bs_1_update.onnx 2
|
||||||
|
|
Loading…
Reference in New Issue