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_helptiling.py 1.7 kB

5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import logging
  15. from akg.utils import kernel_exec as utils
  16. LEVEL1_SUCC = "Help tiling level 1 exit successfully"
  17. LEVEL2_SUCC = "Help tiling level 2 exit successfully"
  18. LEVEL3_SUCC = "Help tiling level 3 exit successfully"
  19. def build_five2four(shape_5d, dtype, op_attrs, attrs, kernel_name='five2four', tuning=False):
  20. from akg.ops.array import five2four
  21. utils.op_build_test(five2four.five2four, [shape_5d], [dtype], op_attrs, kernel_name=kernel_name, attrs=attrs, tuning=tuning)
  22. def test_five2four():
  23. shape_5d = [1, 1, 1088, 1, 16]
  24. dtype = "float32"
  25. op_attrs = [[1, 1088, 1, 16], "float32", 'NHWC']
  26. try:
  27. attrs = {"help_tiling": 1}
  28. build_five2four(shape_5d, dtype, op_attrs, attrs)
  29. except SystemExit:
  30. logging.info(LEVEL1_SUCC)
  31. try:
  32. attrs = {"help_tiling": 2}
  33. build_five2four(shape_5d, dtype, op_attrs, attrs)
  34. except SystemExit:
  35. logging.info(LEVEL2_SUCC)
  36. try:
  37. attrs = {"help_tiling": 3}
  38. build_five2four(shape_5d, dtype, op_attrs, attrs)
  39. except SystemExit:
  40. logging.info(LEVEL3_SUCC)
  41. if __name__ == "__main__":
  42. test_five2four()