You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mssa-2021-002.patch 1.2 kB

1234567891011121314151617181920212223242526272829
  1. From e0cbe113745a38be7b3afa0dff63a819e4490005 Mon Sep 17 00:00:00 2001
  2. From: lzk <liuzhongkai2@huawei.com>
  3. Date: Fri, 21 May 2021 01:11:07 -0700
  4. Subject: [PATCH] div 0 bug fix
  5. ---
  6. .../kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c | 6 ++++++
  7. 1 file changed, 6 insertions(+)
  8. diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c
  9. index c19082141d..e1b73101b3 100644
  10. --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c
  11. +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/space_to_batch_infer.c
  12. @@ -51,6 +51,12 @@ int SpaceToBatchInferShape(const TensorC *const *inputs, size_t inputs_size, Ten
  13. block_w = block_shape[1];
  14. }
  15. + if (block_shape[0] == 0) {
  16. + return NNACL_ERR;
  17. + }
  18. + if (block_w == 0) {
  19. + return NNACL_ERR;
  20. + }
  21. outputs[0]->shape_[kNHWC_N] = input->shape_[kNHWC_N] * (block_shape[0] * block_w);
  22. outputs[0]->shape_[kNHWC_H] = (input->shape_[kNHWC_H] + paddings[0] + paddings[1]) / block_shape[0];
  23. outputs[0]->shape_[kNHWC_W] = (input->shape_[kNHWC_W] + padding_left + padding_right) / block_w;
  24. --
  25. 2.17.1