!18120 MindData fix code clean

Merge pull request !18120 from xiefangqi/md_fix_code_clean4_r1.2
This commit is contained in:
i-robot 2021-06-11 09:27:49 +08:00 committed by Gitee
commit b3eeebe952
2 changed files with 4 additions and 4 deletions

View File

@ -719,7 +719,7 @@ Status NormalizePad(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor
if (rgb.size() != DEFAULT_IMAGE_CHANNELS) {
RETURN_STATUS_UNEXPECTED("NormalizePad: input image is not in RGB.");
}
for (int8_t i = 0; i < DEFAULT_IMAGE_CHANNELS; i++) {
for (uint32_t i = 0; i < DEFAULT_IMAGE_CHANNELS; i++) {
float mean_c, std_c;
RETURN_IF_NOT_OK(mean->GetItemAt<float>(&mean_c, {i}));
RETURN_IF_NOT_OK(std->GetItemAt<float>(&std_c, {i}));

View File

@ -44,8 +44,8 @@ static double GetDet3(double *src) {
return a1 - a2 + a3;
}
static uint8_t IntToUChar(const int &v) {
return static_cast<uint8_t>(static_cast<unsigned>(v) <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0);
static uint8_t UIntToUChar(const uint32_t &v) {
return static_cast<uint8_t>(v <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0);
}
static int16_t IntCastShort(const int &value) {
@ -121,7 +121,7 @@ static const void *InitWBlock() {
return (const void *)iWBlock;
}
static uint8_t CastToFixed(int v) { return IntToUChar(((v + (1 << (BITS1 - 1))) >> BITS1)); }
static uint8_t CastToFixed(int v) { return UIntToUChar((static_cast<uint32_t>(v + (1 << (BITS1 - 1))) >> BITS1)); }
static int BorderPolate(int value, int length, PaddBorderType borderType) {
if (static_cast<unsigned>(value) < static_cast<unsigned>(length)) {