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.

test_tile_eliminate.py 771 B

12345678910111213141516171819202122232425
  1. import numpy as np
  2. from mindspore import ms_function, ops, Tensor, dtype
  3. @ms_function
  4. def expand_tensor(a, b):
  5. out = ops.tile(a, b)
  6. return out
  7. def test_tile_eliminate():
  8. """
  9. Feature: tile_eliminate
  10. Description: All value of multiplier is '1' but length of multiplier is greater than tensor dims, can't do eliminate
  11. Expectation: success
  12. """
  13. tensor_ = Tensor(np.ndarray([1, 448, 448]), dtype=dtype.float32)
  14. out = ops.tile(tensor_, (1, 1, 1))
  15. assert out.shape == (1, 448, 448)
  16. out = ops.tile(tensor_, (1, 1, 1, 1))
  17. assert out.shape == (1, 1, 448, 448)
  18. out = expand_tensor(tensor_, (1, 1, 1))
  19. assert out.shape == (1, 448, 448)
  20. out = expand_tensor(tensor_, (1, 1, 1, 1))
  21. assert out.shape == (1, 1, 448, 448)