!11687 Modify waring

From: @shenwei41
Reviewed-by: @liucunwei,@heleiwang
Signed-off-by: @liucunwei
This commit is contained in:
mindspore-ci-bot 2021-01-27 15:09:22 +08:00 committed by Gitee
commit e21bc108cd
1 changed files with 14 additions and 12 deletions

View File

@ -643,10 +643,14 @@ static bool CheckZero(const std::vector<size_t> &vs) {
return false;
}
static bool CheckMeanAndStd(int channel, const std::vector<float> &mean, const std::vector<float> &std) {
static bool CheckMeanAndStd(const LiteMat &src, LiteMat &dst, int channel, const std::vector<float> &mean,
const std::vector<float> &std) {
if (mean.size() == 0 && std.size() == 0) {
return false;
}
if (src.data_type_ != LDataType::FLOAT32) {
return false;
}
if (mean.size() > 0) {
if (CheckZero(mean)) {
return false;
@ -663,16 +667,6 @@ static bool CheckMeanAndStd(int channel, const std::vector<float> &mean, const s
return false;
}
}
return true;
}
bool SubStractMeanNormalize(const LiteMat &src, LiteMat &dst, const std::vector<float> &mean,
const std::vector<float> &std) {
if (src.data_type_ != LDataType::FLOAT32) {
return false;
}
if (!CheckMeanAndStd(src.channel_, mean, std)) {
return false;
}
if (dst.IsEmpty()) {
dst.Init(src.width_, src.height_, src.channel_, LDataType::FLOAT32);
} else if (dst.height_ != src.height_ || dst.width_ != src.width_ || dst.channel_ != src.channel_) {
@ -680,6 +674,14 @@ bool SubStractMeanNormalize(const LiteMat &src, LiteMat &dst, const std::vector<
} else if (dst.data_type_ != LDataType::FLOAT32) {
return false;
}
return true;
}
bool SubStractMeanNormalize(const LiteMat &src, LiteMat &dst, const std::vector<float> &mean,
const std::vector<float> &std) {
if (!CheckMeanAndStd(src, dst, src.channel_, mean, std)) {
return false;
}
const float *src_start_p = src;
float *dst_start_p = dst;
@ -760,7 +762,7 @@ static void PadWithConstant(const LiteMat &src, LiteMat &dst, const int top, con
}
template <typename T>
void ExtractChannelImpl(T *src_ptr, T *dst_ptr, int height, int width, int channel, int col) {
void ExtractChannelImpl(const T *src_ptr, T *dst_ptr, int height, int width, int channel, int col) {
int total = height * width;
int i = 0;
int src_idx = col;