diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/deconv2d_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/deconv2d_infer.c index e71d7c09f5..5f77ecc1f7 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/deconv2d_infer.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/deconv2d_infer.c @@ -20,7 +20,7 @@ int Deconv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, OpParameter *parameter) { #ifdef Debug - int check_ret = CheckAugmentNullInputSize(inputs, inputs_size, outputs, outputs_size, parameter, 2); + int check_ret = CheckAugmentNull(inputs, inputs_size, outputs, outputs_size, parameter); if (check_ret != NNACL_OK) { return check_ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/uniform_real_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/uniform_real_fp32.cc index b208ac9aa1..8c6eb4f7dd 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/uniform_real_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/uniform_real_fp32.cc @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "src/runtime/kernel/arm/fp32/uniform_real_fp32.h" #include #include -#include "src/runtime/kernel/arm/fp32/uniform_real_fp32.h" +#include #include "src/kernel_registry.h" #include "include/errorcode.h" @@ -26,28 +27,8 @@ using mindspore::schema::PrimitiveType_UniformReal; namespace mindspore::kernel { -template -class Array { - public: - Array() { - for (int i = 0; i < ElementCount; ++i) { - data_[i] = T(0); - } - } - - const T &operator[](int index) const { return data_[index]; } - - T &operator[](int index) { return data_[index]; } - - private: - T data_[ElementCount]; -}; - class PhiloxRandom { public: - using ResultType = Array; - using Key = Array; - explicit PhiloxRandom(uint64_t seed_lo, uint64_t seed_hi) { key_[0] = static_cast(seed_lo); key_[1] = static_cast(seed_lo >> 32); @@ -75,9 +56,9 @@ class PhiloxRandom { // Returns a group of four random numbers using the underlying Philox // algorithm. - ResultType operator()() { - ResultType counter = counter_; - Key key = key_; + std::vector operator()() { + std::vector counter = counter_; + std::vector key = key_; counter = ComputeSingleRound(counter, key); RaiseKey(&key); @@ -129,7 +110,8 @@ class PhiloxRandom { } // Helper function for a single round of the underlying Philox algorithm. - static ResultType ComputeSingleRound(const ResultType &counter, const Key &key) { + static std::vector ComputeSingleRound(const std::vector &counter, + const std::vector &key) { uint32_t lo0; uint32_t hi0; MultiplyHighLow(kPhiloxM4x32A, counter[0], &lo0, &hi0); @@ -138,7 +120,7 @@ class PhiloxRandom { uint32_t hi1; MultiplyHighLow(kPhiloxM4x32B, counter[2], &lo1, &hi1); - ResultType result; + std::vector result = {0, 0, 0, 0}; result[0] = hi1 ^ counter[1] ^ key[0]; result[1] = lo1; result[2] = hi0 ^ counter[3] ^ key[1]; @@ -146,14 +128,14 @@ class PhiloxRandom { return result; } - void RaiseKey(Key *key) { + void RaiseKey(std::vector *key) { (*key)[0] += kPhiloxW32A; (*key)[1] += kPhiloxW32B; } private: - ResultType counter_; - Key key_; + std::vector counter_ = {0, 0, 0, 0}; + std::vector key_ = {0, 0}; }; float uint32ToFloat(uint32_t x) {