Bug in Normalize when num_channels > 128

This commit is contained in:
hesham 2021-05-18 12:23:11 -04:00
parent fd943bbdc0
commit bc92011b5f
2 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,7 @@ namespace mindspore {
namespace dataset {
NormalizeOp::NormalizeOp(const std::vector<float> &mean, const std::vector<float> &std) : mean_(mean), std_(std) {
// pre-calculate normalized mean to be used later in each Compute
for (int8_t i = 0; i < mean.size(); i++) {
for (int64_t i = 0; i < mean.size(); i++) {
mean_[i] = mean_[i] / std_[i];
}
}

View File

@ -367,6 +367,9 @@ def test_multiple_channels():
util_test(np.ones(shape=[20, 45, 4]) * 1.3, mean=[0.5, 0.6, 0.7, 0.8], std=[0.1, 0.2, 0.3, 0.4])
util_test(np.ones(shape=[2, 2]), mean=[0.5], std=[0.1])
util_test(np.ones(shape=[2, 2, 5]), mean=[0.5], std=[0.1])
util_test(np.ones(shape=[6, 6, 129]), mean=[0.5]*129, std=[0.1]*129)
util_test(np.ones(shape=[6, 6, 129]), mean=[0.5], std=[0.1])
if __name__ == "__main__":