From d9a801b5ca86525597159342bc9dc8411a2860a0 Mon Sep 17 00:00:00 2001 From: LeungChiNan <35911879+LeungChiNan@users.noreply.github.com> Date: Sun, 8 Oct 2023 20:10:04 +0800 Subject: [PATCH] add test case (#286) * clamp,clamp_max,clamp_min * where * tanh * tril * permute * pad * prod * cumsum * cdist * bitwise_not * reciprocal * bernoulli * mm * roll * unfold * expand * copy_ * lint * device_config * device config * bernoulli --- .../python/conformance/conformance_test.py | 3 +- .../python/conformance/diopi_configs.py | 582 +++++++++++++++--- .../python/conformance/diopi_functions.py | 19 +- impl/ascend/device_configs.py | 69 ++- impl/camb/device_configs.py | 206 ++++++- 5 files changed, 759 insertions(+), 120 deletions(-) diff --git a/diopi_test/python/conformance/conformance_test.py b/diopi_test/python/conformance/conformance_test.py index 547d8cc28..10304780d 100644 --- a/diopi_test/python/conformance/conformance_test.py +++ b/diopi_test/python/conformance/conformance_test.py @@ -214,7 +214,8 @@ def test_uniform(input, start=0, end=1): def test_bernoulli(input, inplace=False, p=None): p_numpy = input.numpy() - p = p_numpy.mean() if p is None else p + if input.numel() > 0: + p = p_numpy.mean() if p is None else p state = build_generator_state(input.context()) generator = Generator(state) out = F.bernoulli(input, inplace, p, generator) diff --git a/diopi_test/python/conformance/diopi_configs.py b/diopi_test/python/conformance/diopi_configs.py index 1f688e7e7..0d339a73c 100644 --- a/diopi_test/python/conformance/diopi_configs.py +++ b/diopi_test/python/conformance/diopi_configs.py @@ -1217,9 +1217,10 @@ { "ins": ['input'], "requires_grad": [True], - "shape": ((1, ), (1024,), (364800, 4), (2, 128, 3072), + "shape": ((), (1, ), (1024,), (364800, 4), (2, 128, 3072), (256, 128, 3, 3), - (2, 31, 512, 6, 40)), + (2, 31, 512, 6, 40), + (0,), (16, 0), (1, 0, 6)), }, ], ), @@ -1234,9 +1235,10 @@ args=[ { "ins": ['input'], - "shape": ((1, ), (1024,), (364800, 4), (2, 128, 3072), + "shape": ((), (1, ), (1024,), (364800, 4), (2, 128, 3072), (256, 128, 3, 3), - (2, 31, 512, 6, 40)), + (2, 31, 512, 6, 40), + (0,), (16, 0), (1, 0, 6)), }, ], ), @@ -2547,6 +2549,7 @@ ), ), + # FIXME clamp指定组合精度不一致 'clamp_scalar': dict( name=['clamp'], interface=['torch'], @@ -2554,25 +2557,55 @@ atol=1e-4, rtol=1e-5, para=dict( - min=[None, None, 1, -2, None], - max=[4.13, 26, 10, 2, 10], + # min=[-1.1, None, None, True, -2, -0.23, 4, 0, -1, 2.3], + # max=[None, 0.13, 2, 3, 0, -2, False, 2, None, 1.2], + min=[-1.1, None, None, True, -0.23, 0, -1, 2.3], + max=[None, 0.13, 2, 3, -2, 2, None, 1.2], ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": ((182, ), (384, 128), + # "shape": ((), (182, ), (384, 128), + # (1, 242991, 2), + # (2, 4, 100, 152), + # (384, 128), (12, 16), + # (0,), (4, 0), (3, 0, 9)), + "shape": ((), (182, ), (384, 128), (1, 242991, 2), - (2, 4, 100, 152), - (384, 128)), + (384, 128), + (0,), (4, 0), (3, 0, 9)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, - Dtype.int32, Dtype.int64, Dtype.int8], + Dtype.int32, Dtype.int64, Dtype.int8, Dtype.uint8], "gen_fn": Genfunc.randn, }, ], ), ), + # FIXME clamp输入bool报错 + # 'clamp_scalar_bool': dict( + # name=['clamp'], + # interface=['torch'], + # atol=1e-4, + # rtol=1e-5, + # para=dict( + # min=[0.3, False, 1], + # max=[1.2, 1, False], + # ), + # tensor_para=dict( + # args=[ + # { + # "ins": ['input'], + # "shape": ((12, 16), (1, 242991, 2), + # (2, 4, 100, 152),), + # "dtype": [Dtype.bool], + # "gen_fn": Genfunc.mask, + # }, + # ], + # ), + # ), + 'clamp_max_scalar': dict( name=['clamp_max'], interface=['torch'], @@ -2580,16 +2613,17 @@ atol=1e-4, rtol=1e-5, para=dict( - max=[4.13, 26, 2, 1e-12, 10], + max=[True, 4.13, 1, -1, 1e-12, 10, 0, 1.2, -2], ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": ((182, ), (384, 128), + "shape": ((), (182, ), (384, 128), (1, 242991, 2), (2, 4, 100, 152), - (384, 128)), + (384, 128), + (), (2, 0), (16, 0, 9)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, Dtype.int64, Dtype.int8], "gen_fn": Genfunc.randn, @@ -2598,6 +2632,28 @@ ), ), + # FIXME clamp_max输入bool报错 + # 'clamp_max_scalar_bool': dict( + # name=['clamp_max'], + # interface=['torch'], + # atol=1e-4, + # rtol=1e-5, + # para=dict( + # max=[1.2, 1, -0.2], + # ), + # tensor_para=dict( + # args=[ + # { + # "ins": ['input'], + # "shape": ((12, 16), (1, 242991, 2), + # (2, 4, 100, 152),), + # "dtype": [Dtype.bool], + # "gen_fn": Genfunc.mask, + # }, + # ], + # ), + # ), + 'clamp_min_scalar': dict( name=['clamp_min'], interface=['torch'], @@ -2605,16 +2661,17 @@ atol=1e-4, rtol=1e-5, para=dict( - min=[1.2, -1.1, 1, 100, 10], + min=[0, 1.2, -1.1, 1, 100, 10, -2, 2, 0], ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": ((182, ), (384, 128), + "shape": ((), (182, ), (384, 128), (1, 242991, 2), (2, 4, 100, 152), - (384, 128)), + (384, 128), + (), (2, 0), (16, 0, 9)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, Dtype.int64, Dtype.int8], "gen_fn": Genfunc.randn, @@ -2623,6 +2680,28 @@ ), ), + # FIXME clamp输入bool报错 + # 'clamp_min_scalar_bool': dict( + # name=['clamp_min'], + # interface=['torch'], + # atol=1e-4, + # rtol=1e-5, + # para=dict( + # min=[1.2, 1, -0.2], + # ), + # tensor_para=dict( + # args=[ + # { + # "ins": ['input'], + # "shape": ((12, 16), (1, 242991, 2), + # (2, 4, 100, 152),), + # "dtype": [Dtype.bool], + # "gen_fn": Genfunc.mask, + # }, + # ], + # ), + # ), + 'clamp_tensor': dict( name=['clamp'], interface=['torch'], @@ -2635,23 +2714,58 @@ args=[ { "ins": ['input'], - "shape": ((182, ), (384, 128), + "shape": ((), (182, ), (384, 128), (1, 242991, 2), - (2, 4, 100, 152)), + (2, 4, 100, 152), + (0,), (2, 0), (16, 0, 9)), }, { "ins": ['min'], - "shape": ((182, ), (384, 1), - None, (2, 4, 100, 152)), + "shape": ((), (182, ), (384, 1), + None, (2, 4, 100, 152), + (1,), (0,), (0, 9)), }, { "ins": ['max'], - "shape": (None, (384, 128), (1, 1, 2), None), + "shape": ((), None, (384, 128), (1, 1, 2), None, + (0,), (1, 0), (1, 0, 9)), }, ], ), ), + # FIXME clamp broadcast报错 + # 'clamp_tensor_broadcast': dict( + # name=['clamp'], + # interface=['torch'], + # atol=1e-4, + # rtol=1e-5, + # tensor_para=dict( + # dtype=[Dtype.int16, Dtype.int32, Dtype.int64, Dtype.int8, Dtype.uint8], + # gen_fn=Genfunc.randn, + # args=[ + # { + # "ins": ['input'], + # "shape": ((), (182,), (384, 128), + # (1, 242991, 2), + # (2, 4, 100, 152), + # (0,), (2, 0), (16, 0, 9)), + # }, + # { + # "ins": ['min'], + # "shape": ((1,), (2, 182), (384, 1), + # None, (2, 4, 100, 152), + # (2, 1,), (3, 2, 0,), (0, 9)), + # }, + # { + # "ins": ['max'], + # "shape": ((), None, (2, 1, 128), (1, 1, 2), None, + # (2, 0,), (1, 0), (2, 1, 0, 9)), + # }, + # ], + # ), + # ), + # FIXME clamp输入不同dtype结果不一致 # 'clamp_tensor_diff_dtype': dict( # name=['clamp'], @@ -2697,23 +2811,81 @@ atol=1e-4, rtol=1e-5, tensor_para=dict( - dtype=[Dtype.float32, Dtype.float64], + dtype=[Dtype.float16, Dtype.float32, Dtype.float64], gen_fn=Genfunc.randn, args=[ { "ins": ['input'], "shape": ((182,), (384, 128), - (1, 242991, 2,), - (2, 4, 100, 152)), + (3, 242991, 2,), + (2, 4, 100, 152), + (0,), (9, 0), (2, 0, 9)), }, { "ins": ['max'], - "shape": ((1,), (1, ), (1, 1, 1), (1,)), + "shape": ((1,), (128, ), (3, 1, 2), (4, 100, 152), + (0,), (1,), (0, 9)), }, ], ), ), + # FIXME clamp_max broadcast报错 + # 'clamp_max_broadcast': dict( + # name=['clamp_max'], + # interface=['torch'], + # atol=1e-4, + # rtol=1e-5, + # tensor_para=dict( + # dtype=[Dtype.int16, Dtype.int32, Dtype.int64, Dtype.int8, Dtype.uint8], + # gen_fn=Genfunc.randn, + # args=[ + # { + # "ins": ['input'], + # "shape": ((), (182,), (384, 128), + # (1, 242991, 2), + # (2, 4, 100, 152), + # (0,), (2, 0), (16, 0, 9)), + # }, + # { + # "ins": ['max'], + # "shape": ((), (2, 182), (2, 1, 128), (2, 1, 1, 2), (1, 100, 152), + # (2, 0,), (1, 0), (2, 1, 0, 9)), + # }, + # ], + # ), + # ), + + # FIXME clamp_max输入不同dtype结果不一致 + # 'clamp_max_tensor_diff_dtype': dict( + # name=['clamp_max'], + # interface=['torch'], + # is_inplace=True, + # atol=1e-4, + # rtol=1e-5, + # tensor_para=dict( + # gen_fn=Genfunc.randn, + # args=[ + # { + # "ins": ['input'], + # "shape": ((182,), (384, 128), + # (1, 242991, 2), + # (2, 4, 100, 152)), + # "dtype":[Dtype.float32, Dtype.float64, Dtype.float16, + # Dtype.int16, Dtype.int32, Dtype.int64, + # Dtype.int8, Dtype.uint8, Dtype.float32], + # }, + # { + # "ins": ['max'], + # "shape": ((182,), (384, 128), (1, 1, 2), (4, 1, 152)), + # "dtype":[Dtype.float32, Dtype.bool, Dtype.float16, + # Dtype.uint8, Dtype.int32, Dtype.int64, + # Dtype.int32, Dtype.int8, Dtype.int16], + # }, + # ], + # ), + # ), + 'clamp_min_tensor': dict( name=['clamp_min'], interface=['torch'], @@ -2721,23 +2893,81 @@ atol=1e-4, rtol=1e-5, tensor_para=dict( - dtype=[Dtype.float32, Dtype.float64], + dtype=[Dtype.float16, Dtype.float32, Dtype.float64], gen_fn=Genfunc.randn, args=[ { "ins": ['input'], "shape": ((182,), (384, 128), - (1, 242991, 2,), - (2, 4, 100, 152)), + (3, 242991, 2,), + (2, 4, 100, 152), + (0,), (9, 0), (2, 0, 9)), }, { "ins": ['min'], - "shape": ((1,), (1, ), (1, 1, 1), (1,)), + "shape": ((1,), (128, ), (3, 1, 2), (4, 100, 152), + (0,), (1,), (0, 9)), }, ], ), ), + # FIXME clamp_min broadcast报错 + # 'clamp_min_broadcast': dict( + # name=['clamp_min'], + # interface=['torch'], + # atol=1e-4, + # rtol=1e-5, + # tensor_para=dict( + # dtype=[Dtype.int16, Dtype.int32, Dtype.int64, Dtype.int8, Dtype.uint8], + # gen_fn=Genfunc.randn, + # args=[ + # { + # "ins": ['input'], + # "shape": ((), (182,), (384, 128), + # (1, 242991, 2), + # (2, 4, 100, 152), + # (0,), (2, 0), (16, 0, 9)), + # }, + # { + # "ins": ['min'], + # "shape": ((), (2, 182), (2, 1, 128), (2, 1, 1, 2), (1, 100, 152), + # (2, 0,), (1, 0), (2, 1, 0, 9)), + # }, + # ], + # ), + # ), + + # FIXME clamp_min输入不同dtype结果不一致 + # 'clamp_min_tensor_diff_dtype': dict( + # name=['clamp_min'], + # interface=['torch'], + # is_inplace=True, + # atol=1e-4, + # rtol=1e-5, + # tensor_para=dict( + # gen_fn=Genfunc.randn, + # args=[ + # { + # "ins": ['input'], + # "shape": ((182,), (384, 128), + # (1, 242991, 2), + # (2, 4, 100, 152)), + # "dtype":[Dtype.float32, Dtype.float64, Dtype.float16, + # Dtype.int16, Dtype.int32, Dtype.int64, + # Dtype.int8, Dtype.uint8, Dtype.float32], + # }, + # { + # "ins": ['min'], + # "shape": ((182,), (384, 128), (1, 1, 2), (4, 1, 152)), + # "dtype":[Dtype.float32, Dtype.bool, Dtype.float16, + # Dtype.uint8, Dtype.int32, Dtype.int64, + # Dtype.int32, Dtype.int8, Dtype.int16], + # }, + # ], + # ), + # ), + 'fill': dict( name=["fill_"], interface=["torch.Tensor"], @@ -3744,14 +3974,15 @@ name=["tril"], interface=["torch"], para=dict( - diagonal=[0, -1, 1], + diagonal=[12, 0, 5, -9, -1, 1, 2, 10, -10], ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": ((6, 7), (6, 8, 8), - (64, 7, 28, 28)), + "shape": ((8, 9), (6, 7), (6, 6), (9, 9), + (6, 8, 8), (64, 7, 28, 28), + (2, 0), (12, 0), (2, 0, 9)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, Dtype.int64, Dtype.uint8, Dtype.int8, Dtype.bool], "gen_fn": Genfunc.randn, @@ -4015,7 +4246,8 @@ args=[ { "ins": ['condition'], - "shape": [(1024, ), (1482, 4), (4, 5, 6)], + "shape": [(), (1024, ), (1482, 4), (4, 5, 6), + (0,), (2, 0), (2, 0, 9)], "dtype": [Dtype.uint8, Dtype.bool], "gen_fn": Genfunc.mask }, @@ -4023,7 +4255,8 @@ "ins": ['input', 'other'], "dtype": [Dtype.float16, Dtype.float32, Dtype.float64, Dtype.int16, Dtype.int32, Dtype.int64, Dtype.uint8, Dtype.int8, Dtype.bool], - "shape": [(1024, ), (1482, 4), (4, 5, 6)], + "shape": [(), (1024, ), (1482, 4), (4, 5, 6), + (0,), (2, 0), (2, 0, 9)], "gen_fn": Genfunc.randn }, ], @@ -4037,28 +4270,61 @@ args=[ { "ins": ['condition'], - "shape": [(1, ), (3, ), (3, ), (1, 445), (3, 5), (4, ), - (3, 4, 5), (3, )], + "shape": [(), (1, ), (3, ), (3, ), (1, 445), (3, 5), (4, ), + (3, 4, 5), (3, ), (0,), (2, 0), (2, 0, 9)], "dtype": [Dtype.uint8, Dtype.bool], "gen_fn": Genfunc.mask }, { "ins": ['input'], "dtype": [Dtype.float32, Dtype.float64], - "shape": [(1, ), (1, ), (3, ), (1, 445), (3, 5), (1, ), (4, 5), - (5, 4, 3)], + "shape": [(1,), (2, 7), (1, ), (3, ), (2, 445), (3, 5), (1, ), (4, 5), + (5, 4, 3), (1,), (6, 2, 0), (2, 1, 9)], "gen_fn": Genfunc.randn }, { "ins": ['other'], "dtype": [Dtype.float32, Dtype.float64], - "shape": [(1, ), (1, ), (1, ), (1, ), (1, ), (4, ), (5, ), (4, 3)], + "shape": [(8,), (7,), (2, 1), (1, ), (1, ), (1, ), (4, ), (5, ), (4, 3), + (0,), (2, 1), (0, 1)], "gen_fn": Genfunc.randn }, ], ), ), + # FIXME where输入不同dtype,计算结果不一致 + # 'where_diff_dtype': dict( + # name=['where'], + # interface=['torch'], + # tensor_para=dict( + # args=[ + # { + # "ins": ['condition'], + # "shape": [(3, 4), ], + # "dtype": [Dtype.bool], + # "gen_fn": Genfunc.mask + # }, + # { + # "ins": ['input'], + # "dtype": [Dtype.float16, Dtype.float32, Dtype.float64, + # Dtype.int16, Dtype.int32, Dtype.int64, + # Dtype.uint8, Dtype.int8, Dtype.bool], + # "shape": [(3, 4), ], + # "gen_fn": Genfunc.randn + # }, + # { + # "ins": ['other'], + # "dtype": [Dtype.float32, Dtype.int32, Dtype.float32, + # Dtype.float16, Dtype.float32, Dtype.bool, + # Dtype.int8, Dtype.uint8, Dtype.uint8], + # "shape": [(3, 4), ], + # "gen_fn": Genfunc.randn + # }, + # ], + # ), + # ), + 'where_same_value': dict( name=['where'], interface=['torch'], @@ -4717,7 +4983,8 @@ args=[ { "ins": ['input'], - "shape": ((1,), (182,), (64, 128), (2, 1, 640, 640)), + "shape": ((), (1,), (182,), (64, 128), (2, 1, 640, 640), + (0,), (12, 0), (4, 0, 9)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16], }, ], @@ -4741,6 +5008,25 @@ ), ), + 'reciprocal_zero': dict( + name=["reciprocal"], + interface=['torch'], + atol=1e-4, + rtol=1e-5, + tensor_para=dict( + gen_fn=Genfunc.zeros, + args=[ + { + "ins": ['input'], + "shape": ((182,),), + "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, + Dtype.int16, Dtype.int32, Dtype.int64, + Dtype.uint8, Dtype.int8, Dtype.bool], + }, + ], + ), + ), + # FXIME adamw、adam输出精度不一致 'adam': dict( name=['adam', 'adamw'], @@ -4851,9 +5137,9 @@ atol=1e-4, rtol=1e-5, para=dict( - dimension=[2, 1, 2, -1, 0], - size=[2, 2, 2, 2, 2], - step=[1, 1, 1, 3, 1], + dimension=[2, 1, 2, 1, 1, -1, -1, 0, -1, -2, 2], + size=[2, 2, 4, 5, 20, 2, 10, 1, 0, 3, 5], + step=[1, 1, 1, 3, 2, 1, 3, 2, 1, 2, 3], ), tensor_para=dict( gen_fn=Genfunc.randn, @@ -4861,7 +5147,8 @@ { "ins": ['input'], "requires_grad": [True], - "shape": ((2, 128, 56, 56), (2, 512, 14, 14), (2, 96, 200, 304), (2, 128, 36), (16,)), + "shape": ((2, 128, 56, 56), (2, 512, 14, 14), (2, 96, 200, 304), (2, 128, 36), (10, 20), (16,), (20,), (), + (0,), (16, 0), (4, 0, 16)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16], }, ], @@ -4875,7 +5162,7 @@ rtol=1e-5, para=dict( dimension=[2, 1, 2, -1, 0], - size=[2, 2, 2, 2, 2], + size=[2, 4, 1, 5, 16], step=[1, 1, 1, 3, 1], ), tensor_para=dict( @@ -4895,15 +5182,15 @@ interface=['torch'], atol=1e-6, rtol=1e-5, - dtype=[Dtype.float32], para=dict( - dim=[1, 2, 0, -1], + dim=[0, -1, 1, 2, 0, -1, -1, -2, 1], ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": ((2, 22, 33), (2, 2, 10, 16), (1, 20), (2, 2, 20)), + "shape": ((), (12,), (2, 22, 33), (2, 2, 10, 16), (1, 20), (2, 2, 20), + (0,), (5, 0), (4, 0, 12)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, Dtype.int64, Dtype.uint8, Dtype.int8, Dtype.bool], "gen_fn": Genfunc.randn, @@ -4919,22 +5206,28 @@ rtol=1e-3, saved_args=dict(output=0), para=dict( - p=[1, 2, 0, 0.5, float("inf")], + p=[1, 2, 0, 0.5, float("inf"), 1.2, 0, 2, 1, 2, 0], compute_mode=['use_mm_for_euclid_dist', 'donot_use_mm_for_euclid_dist', 'use_mm_for_euclid_dist_if_necessary', - 'use_mm_for_euclid_dist_if_necessary', 'use_mm_for_euclid_dist_if_necessary'] + 'use_mm_for_euclid_dist_if_necessary', 'use_mm_for_euclid_dist', 'donot_use_mm_for_euclid_dist', + 'use_mm_for_euclid_dist_if_necessary', 'use_mm_for_euclid_dist_if_necessary', + 'use_mm_for_euclid_dist', 'donot_use_mm_for_euclid_dist', 'use_mm_for_euclid_dist_if_necessary'] ), tensor_para=dict( args=[ { "ins": ['x1'], "requires_grad": [True], - "shape": ((2, 50, 4), (1, 32, 32), (4, 31, 256), (4, 256, 256), (10, 128)), + "shape": ((2, 50, 4), (1, 32, 32), (4, 31, 256), (4, 256, 256), (10, 128), + (2, 50, 4), (1, 32, 32), (4, 31, 256), + (0, 4, 5), (4, 0, 9), (3, 0)), "dtype": [Dtype.float32, Dtype.float64], "gen_fn": Genfunc.randn, }, { "ins": ['x2'], - "shape": ((100, 4), (32, 2, 48, 64, 32), (4, 256, 256), (4, 256, 256), (1, 10, 128)), + "shape": ((100, 4), (32, 2, 48, 64, 32), (4, 256, 256), (4, 256, 256), (1, 10, 128), + (100, 4), (32, 2, 48, 64, 32), (4, 256, 256), + (0, 6, 5), (4, 5, 9), (2, 1, 0)), "dtype": [Dtype.float32, Dtype.float64], "gen_fn": Genfunc.randn, }, @@ -4977,7 +5270,7 @@ ), ), - 'bitwise_not': dict( + 'bitwise_not_uint8': dict( name=['bitwise_not'], interface=['torch'], is_inplace=True, @@ -4985,9 +5278,10 @@ args=[ { "ins": ['input'], - "shape": ((1,), (100, 4), (2, 256, 256)), - "dtype": [Dtype.bool, Dtype.int32], - "gen_fn": Genfunc.randn, + "shape": ((), (1,), (100, 4), (2, 256, 256), + (0,)), + "dtype": [Dtype.uint8], + "gen_fn": dict(fn=Genfunc.randint, low=0, high=256), }, ], ), @@ -5001,10 +5295,11 @@ args=[ { "ins": ['input'], - "shape": ((10,), (100, 4), (2, 256, 256)), + "shape": ((10,), (100, 4), (2, 256, 256), + (4, 0), (8, 0, 9)), "dtype": [Dtype.bool, Dtype.int16, Dtype.int32, Dtype.int64, - Dtype.int8, Dtype.uint8], - "gen_fn": dict(fn=Genfunc.randint, low=0, high=2), + Dtype.int8], + "gen_fn": dict(fn=Genfunc.randint, low=-128, high=128), }, ], ), @@ -5530,13 +5825,34 @@ { "ins": ['input'], "shape": ((8, 48), (4, 128), (256, 8)), - "dtype": [Dtype.float32, Dtype.float64], + "dtype": [Dtype.float32, Dtype.float64, Dtype.float16], "gen_fn": Genfunc.randn, }, { "ins": ['mat2'], "shape": ((48, 128), (128, 128), (8, 1)), - "dtype": [Dtype.float32, Dtype.float64], + "dtype": [Dtype.float32, Dtype.float64, Dtype.float16], + "gen_fn": Genfunc.randn, + }, + ], + ), + ), + + 'mm_diff_dtype': dict( + name=['mm'], + interface=['torch'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "shape": ((8, 0), (0, 128), (256, 8)), + "dtype": [Dtype.float32, Dtype.float16, Dtype.float64], + "gen_fn": Genfunc.randn, + }, + { + "ins": ['mat2'], + "shape": ((0, 128), (128, 128), (8, 0)), + "dtype": [Dtype.float16, Dtype.float64, Dtype.float32], "gen_fn": Genfunc.randn, }, ], @@ -5675,13 +5991,15 @@ name=['expand'], interface=['torch.Tensor'], para=dict( - size=[(60800, 3), (-1, 4), (-1, 8, -1), (7, 3, -1)], + size=[(0,), (5,), (8, 2), (4, -1), (60800, 3), (-1, 4), (-1, 8, -1), (7, 3, -1), (5, -1, 8, 6, -1), + (2, 0), (4, -1, -1), (-1, -1, 9)], ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": [(60800, 1), (100, 1), (70, 1, 2), (3, 1)], + "shape": [(), (), (), (8,), (60800, 1), (100, 1), (70, 1, 2), (3, 1), (4, 1, 6, 8), + (0,), (12, 0), (4, 0, 1)], "gen_fn": Genfunc.randn, "dtype": [Dtype.float32, Dtype.bool, Dtype.float16, Dtype.float64, Dtype.int64, Dtype.int32, Dtype.int16, Dtype.int8, Dtype.uint8], @@ -5708,13 +6026,13 @@ name=['permute'], interface=['torch'], para=dict( - dims=[(0, 1, 3, 2, 4, 5), (2, 0, 1), (0, 2, 3, 1), (1, 0), (0, -2, -1), (0,), (0,)], + dims=[(), (0, 1, 3, 2, 4, 5), (2, 0, 1), (0, 2, 3, -3), (1, 0), (0, -2, -1), (0,), (-1,)], ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": [(2, 8, 7, 8, 7, 128), (49, 49, 4), (2, 3, 200, 304), (20267, 1), (2, 3, 4), (0,), (1,)], + "shape": [(), (2, 8, 7, 8, 7, 128), (49, 49, 4), (2, 3, 200, 304), (20267, 1), (2, 3, 4), (0,), (1,)], "gen_fn": Genfunc.randn, "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, Dtype.int64, Dtype.uint8, Dtype.int8, Dtype.bool], @@ -5726,14 +6044,20 @@ 'pad': dict( name=['pad'], para=dict( - pad=[(0, 3), (0, 1, 0, 1), (1, 1, 1, 1), (0, 193)], - mode=['circular', 'replicate', 'reflect', 'replicate'], + pad=[(2, 4), (0, 3), (7, -14, 2, 3), (0, 1, 0, 1), (0, 1, -1, 3, 1, 2), (0, 2, -1, 1, 1, 5), + (2, 4), (0, 3), (7, -14, 2, 3), (0, 1, 0, 1), (0, 1, -1, 3, 1, 2), (0, 2, -1, 1, 1, 5), + (0, 3), (0, 1, 0, 1), (0, 2, -1, 1, 1, 5)], + mode=['reflect', 'reflect', 'reflect', 'reflect', 'reflect', 'reflect', + 'replicate', 'replicate', 'replicate', 'replicate', 'replicate', 'replicate', + 'circular', 'circular', 'circular'], ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": [(2, 56, 56), (2, 3, 260, 260), (2, 144, 65, 65), (3, 576, 862)], + "shape": [(4, 5), (2, 56, 56), (12, 4, 8), (2, 3, 260, 260), (2, 144, 65, 65), (3, 576, 862, 2, 3), + (4, 5), (2, 56, 56), (12, 4, 8), (2, 3, 260, 260), (2, 144, 65, 65), (3, 576, 862, 2, 3), + (2, 56, 56), (2, 3, 260, 260), (3, 576, 862, 2, 3)], "gen_fn": Genfunc.randn, "dtype": [Dtype.float32, Dtype.float64, Dtype.float16], }, @@ -5762,15 +6086,20 @@ 'constant_pad': dict( name=['pad'], para=dict( - pad=[(0, 3), (0, 1, 0, 1), (1, 1, 1, 1), (0, 193)], - mode=['constant', 'constant', 'constant', 'constant'], - value=[100, 0, -1, 1] + pad=[(), (4, 6), (), (-1, 2, 0, -2), (0, 3), (0, 1, 0, 1), (1, 1, 1, 1), (0, 193), + (-1, 2, 0, -2, 2, 3), (1, 2, 0, 2, 1, 4, 5, 6), (-1, 2, 1, 2, 0, 2, 1, 4, 5, 6), + (1, 0), (1, 2, 3, 5)], + mode=['constant', 'constant', 'constant', 'constant', 'constant', 'constant', 'constant', + 'constant', 'constant', 'constant', 'constant', 'constant', 'constant'], + value=[None, -0.3, 0.2, 0, 100, 0, -1, 1, -3, 3, False, 1e-2, 2.4] ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": [(2, 56, 56), (2, 3, 260, 260), (2, 144, 65, 65), (3, 576, 862)], + "shape": [(), (5,), (2, 3), (4, 5), (2, 56, 56), (2, 3, 260, 260), (2, 144, 65, 65), (3, 576, 862), + (3, 4, 5), (3, 4, 5, 6), (3, 4, 5, 6, 7), + (0,), (4, 0)], "gen_fn": Genfunc.randn, "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, Dtype.int64, Dtype.int8, Dtype.bool], @@ -5802,13 +6131,15 @@ name=['roll'], interface=['torch'], para=dict( - shifts=[1, (0, 1), (3, 3), (-3, -3), (1, 3), (1, 2), (1, 2)], - dims=[None, (0, 1), (1, 2), (1, 2), (-1, -2), (1, 2), (1, 1)], + shifts=[-2, (2,), 9, 0, (0, 1), (3, 3), (-3, -3), (1, 3), (1, 2), (1, 2), 0, (0, 7), (3, 12)], + dims=[None, (0,), None, -2, (0, 1), (1, 2), (1, 2), (-1, -2), (1, 2), (1, 1), None, (0, -1), (2, 2)], ), tensor_para=dict( args=[ { - "shape": ((4,), (8, 32), (2, 14, 14, 512), (2, 56, 56, 128), (2, 14, 14, 512), (2, 14, 14, 512), (2, 14, 14, 512)), + "shape": ((), (8,), (4,), (4, 16), (8, 32), (2, 14, 14, 512), (2, 56, 56, 128), + (2, 14, 14, 512), (2, 14, 14, 512), (2, 14, 14, 512), + (0,), (3, 0), (2, 0, 5)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.bool, Dtype.int64, Dtype.int32, Dtype.int16, Dtype.int8, Dtype.uint8, Dtype.bool], "gen_fn": Genfunc.randn, @@ -5898,17 +6229,40 @@ name=['unique'], interface=['torch'], para=dict( - sorted=[True, False, True, False], - return_inverse=[True, False, True, False], - return_counts=[True, False, True, False], - dim=[-1, 0, None, 0], + sorted=[True, True, False, True, False, False, True, False], + return_inverse=[False, True, True, False, True, True, False, True], + return_counts=[False, False, True, True, True, False, True, False], + dim=[None, -1, 1, None, 2, 0, 1, -2], ), tensor_para=dict( gen_fn=Genfunc.randn, args=[ { "ins": ['input'], - "shape": ((0,), (252,), (2, 256), (4, 64, 128)), + "shape": ((), (252,), (2, 256), (4, 64, 128), (4, 2, 12, 3), + (0,), (2, 0), (7, 0, 9)), + "dtype": [Dtype.int64, Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, + Dtype.int32, Dtype.uint8, Dtype.int8, Dtype.bool], + }, + ], + ), + ), + + 'unique_same_value': dict( + name=['unique'], + interface=['torch'], + para=dict( + sorted=[True, True, False, True], + return_inverse=[False, True, True, False], + return_counts=[False, False, True, True], + dim=[None, -1, 1, None], + ), + tensor_para=dict( + gen_fn=Genfunc.ones, + args=[ + { + "ins": ['input'], + "shape": ((252,), (2, 256), (4, 64, 128), (4, 2, 12, 3)), "dtype": [Dtype.int64, Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, Dtype.uint8, Dtype.int8, Dtype.bool], }, @@ -5922,14 +6276,16 @@ atol_half=1e-4, rtol_half=1e-3, para=dict( - dim=[-1, 0, -1, 0], - dtype=[Dtype.float64, Dtype.float32, Dtype.int64, Dtype.int64] + dim=[0, -1, 0, -1, 1, 3, -1, 0, -2], + dtype=[Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, + Dtype.int64, Dtype.uint8, Dtype.int8, Dtype.bool] ), tensor_para=dict( args=[ { "ins": ['input'], - "shape": ((56, 1), (70, 1, 2), (2, 512, 38, 38), (2, 80, 128, 128, 1)), + "shape": ((), (42,), (56, 1), (70, 1, 2), (2, 512, 38, 38), (2, 80, 128, 128, 1), + (0,), (3, 0), (2, 0, 6)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.int16, Dtype.int32, Dtype.int64, Dtype.uint8, Dtype.int8, Dtype.bool], "gen_fn": Genfunc.randn, @@ -6813,20 +7169,41 @@ no_output_ref=True, is_inplace=True, para=dict( - p=[None, 0.5, None, None], + p=[0.1, None, 0.5, None, None, 0.7, None, None], ), tensor_para=dict( gen_fn=Genfunc.rand, args=[ { "ins": ['input'], - "shape": ((1, ), (64, 64), (16, 1, 3, 3), (96, 48, 3, 3)), + "shape": ((), (1, ), (64, 64), (16, 1, 3, 3), (96, 48, 3, 3), + (0,), (4, 0), (5, 0, 7)), "dtype": [Dtype.float32, Dtype.float64, Dtype.float16], }, ], ), ), + 'bernoulli_int': dict( + name=['bernoulli'], + no_output_ref=True, + is_inplace=True, + para=dict( + p=[0.1, 0, 0.5, True], + ), + tensor_para=dict( + gen_fn=Genfunc.rand, + args=[ + { + "ins": ['input'], + "shape": ((), (5, ), (2, 3), (2, 1, 6)), + "dtype": [Dtype.int64, Dtype.int32, Dtype.int16, + Dtype.int8, Dtype.uint8, Dtype.bool], + }, + ], + ), + ), + 'layer_norm': dict( name=["layer_norm"], dtype=[Dtype.float32, Dtype.float64, Dtype.float16], @@ -6900,12 +7277,14 @@ args=[ { "ins": ["input"], - "shape": ((192, 147), (1, 1, 384), (2, 1, 38, 45)), + "shape": ((), (8,), (12,), (192, 147), (1, 1, 384), (2, 1, 38, 45), + (0,), (0, 12,), (12, 0, 9)), "no_contiguous": [True], }, { "ins": ["other"], - "shape": ((147, 1), (384, 1, 1), (45, 38, 1, 2)), + "shape": ((), (), (12,), (147, 1), (384, 1, 1), (45, 38, 1, 2), + (0,), (12, 0), (9, 0, 12)), }, ] ) @@ -6920,18 +7299,43 @@ { "ins": ["input"], "shape": ((192, 147), (1, 1, 384), (2, 1, 38, 45), (100, 100)), - "dtype": [Dtype.float32, Dtype.float64], + "dtype": [Dtype.float32, Dtype.float64, Dtype.float16, Dtype.bool, + Dtype.int64, Dtype.int32, Dtype.int16, Dtype.int8, Dtype.uint8], "no_contiguous": [True], }, { "ins": ["other"], - "dtype": [Dtype.int32, Dtype.int64], + "dtype": [Dtype.float64, Dtype.int64, Dtype.float16, Dtype.float16, + Dtype.int32, Dtype.float32, Dtype.uint8, Dtype.uint8, Dtype.uint8], "shape": ((147, 1), (384, 1, 1), (45, 38, 1, 2), (1, 100)), }, ] ) ), + 'copy_broadcast': dict( + name=["copy_"], + interface=['torch.Tensor'], + dtype=[Dtype.float32, Dtype.float64], + tensor_para=dict( + gen_fn=Genfunc.randn, + args=[ + { + "ins": ["input"], + "shape": ((8,), (12, 2), (192, 147, 2), (6, 5, 384), (2, 12, 38, 45, 3), + (0, 2), (0, 12,), (12, 0, 9, 2)), + "no_contiguous": [True], + }, + { + "ins": ["other"], + "shape": ((1,), (12,), (1, 147), (6, 1, 384), (2, 1, 38, 45), + (1,), (0, 1,), (12, 0, 1)), + "no_contiguous": [True], + }, + ] + ) + ), + # FIXME interpolate输入mode为linear,做down sample精度不一致 'interpolate': dict( name=["interpolate"], diff --git a/diopi_test/python/conformance/diopi_functions.py b/diopi_test/python/conformance/diopi_functions.py index e8b61318b..02731a598 100644 --- a/diopi_test/python/conformance/diopi_functions.py +++ b/diopi_test/python/conformance/diopi_functions.py @@ -1357,8 +1357,8 @@ def where(condition, input, other) -> Tensor: sizeC = condition.size().data sizeO = broadcast_out_size(sizeX, sizeY) sizeO = broadcast_out_size(sizeC, sizeO) - assert (input.get_dtype() == other.get_dtype()),\ - " input and other shoule be the same type " + # assert (input.get_dtype() == other.get_dtype()),\ + # " input and other shoule be the same type " out = Tensor(sizeO, input.get_dtype()) func = check_function("diopiWhere") @@ -2451,7 +2451,10 @@ def cumsum(input, dim, dtype=None): assert isinstance(dim, int), "dim should be int" sizeI = list(input.size().data) - assert dim < len(sizeI), "dim out of index" + if len(sizeI) == 0: + assert dim in (0, -1), "dim out of index" + else: + assert dim < len(sizeI), "dim out of index" out = Tensor(input.size().data, promote_type(input, Dtype.int64)) if dtype is None else Tensor(input.size().data, dtype) func = check_function("diopiCumsum") @@ -2785,8 +2788,12 @@ def expand(input, size) -> Tensor: def unfold(input, dimension, size, step): sizeO = list(input.size().data) - sizeO[dimension] = int((sizeO[dimension] - size) / step + 1) - sizeO.append(size) + + if len(sizeO) == 0: + sizeO = [1] + else: + sizeO[dimension] = int((sizeO[dimension] - size) / step + 1) + sizeO.append(size) out = Tensor(sizeO, input.get_dtype()) func = check_function("diopiUnfold") @@ -2878,6 +2885,8 @@ def roll(input, shifts, dims=None): shifts = (shifts, ) shifts = Sizes(list(shifts)) + if isinstance(dims, int): + dims = (dims, ) if dims is not None: dims = Sizes(list(dims)) else: diff --git a/impl/ascend/device_configs.py b/impl/ascend/device_configs.py index 64e7b18a0..227e0ee26 100755 --- a/impl/ascend/device_configs.py +++ b/impl/ascend/device_configs.py @@ -500,7 +500,7 @@ args=[ { "ins": ['input'], - "shape": [Skip((1,)),Skip((1024,)),Skip((364800, 4)),Skip((2, 128, 3072)),Skip((256, 128, 3, 3)),Skip((2, 31, 512, 6, 40)),], + "shape": [Skip(()), Skip((1,)),Skip((1024,)),Skip((364800, 4)),Skip((2, 128, 3072)),Skip((256, 128, 3, 3)),Skip((2, 31, 512, 6, 40)),Skip((0,)),Skip((16, 0)),Skip((1, 0, 6))], }, ] ), @@ -512,7 +512,7 @@ args=[ { "ins": ['input'], - "shape": [Skip((1,)),Skip((1024,)),Skip((364800, 4)),Skip((2, 128, 3072)),Skip((256, 128, 3, 3)),Skip((2, 31, 512, 6, 40)),], + "shape": [Skip(()), Skip((1,)),Skip((1024,)),Skip((364800, 4)),Skip((2, 128, 3072)),Skip((256, 128, 3, 3)),Skip((2, 31, 512, 6, 40)),Skip((0,)),Skip((16, 0)),Skip((1, 0, 6)),], }, ] ), @@ -1136,7 +1136,7 @@ args=[ { "ins": ['input'], - "dtype": [Skip(Dtype.float32),Skip(Dtype.float64),Skip(Dtype.float16),Skip(Dtype.int16),Skip(Dtype.int32),Skip(Dtype.int64),Skip(Dtype.int8),], + "dtype": [Skip(Dtype.float32),Skip(Dtype.float64),Skip(Dtype.float16),Skip(Dtype.int16),Skip(Dtype.int32),Skip(Dtype.int64),Skip(Dtype.int8),Skip(Dtype.uint8),], }, ] ), @@ -1172,7 +1172,8 @@ args=[ { "ins": ['input'], - "shape": [Skip((182,)),Skip((384, 128)),Skip((1, 242991, 2)),Skip((2, 4, 100, 152)),], + "shape": [Skip((182,)),Skip((384, 128)),Skip((1, 242991, 2)),Skip((2, 4, 100, 152)),Skip((0,)),Skip((2, 0,)),Skip((16, 0, 9)),], + "dtype": [Skip(Dtype.float64)] }, ] ), @@ -1184,7 +1185,7 @@ args=[ { "ins": ['input'], - "shape": [Skip((182,)),Skip((384, 128)),Skip((1, 242991, 2)),Skip((2, 4, 100, 152)),], + "shape": [Skip((182,)),Skip((384, 128)),Skip((2, 4, 100, 152)),], }, ] ), @@ -1196,7 +1197,7 @@ args=[ { "ins": ['input'], - "shape": [Skip((182,)),Skip((384, 128)),Skip((1, 242991, 2)),Skip((2, 4, 100, 152)),], + "shape": [Skip((182,)),Skip((384, 128)),Skip((2, 4, 100, 152)),], }, ] ), @@ -1961,6 +1962,18 @@ ] ), ), + + 'reciprocal_zero': dict( + name=['reciprocal'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "dtype": [Skip(Dtype.float32),Skip(Dtype.float64),Skip(Dtype.float16),Skip(Dtype.int16),Skip(Dtype.int32),Skip(Dtype.int64),Skip(Dtype.uint8),Skip(Dtype.int8),Skip(Dtype.bool)], + }, + ] + ), + ), 'conv_transpose2d': dict( name=['conv_transpose2d'], @@ -2052,7 +2065,7 @@ args=[ { "ins": ['input'], - "dtype": [Skip(Dtype.bool),Skip(Dtype.int16),Skip(Dtype.int32),Skip(Dtype.int64),Skip(Dtype.int8),Skip(Dtype.uint8),], + "dtype": [Skip(Dtype.bool),Skip(Dtype.int16),Skip(Dtype.int32),Skip(Dtype.int64),Skip(Dtype.int8),], }, ] ), @@ -2280,7 +2293,19 @@ args=[ { "ins": ['input'], - "dtype": [Skip(Dtype.float32),Skip(Dtype.float64),], + "dtype": [Skip(Dtype.float32),Skip(Dtype.float64),Skip(Dtype.float16),], + }, + ] + ), + ), + + 'mm_diff_dtype': dict( + name=['mm'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "dtype": [Skip(Dtype.float32),Skip(Dtype.float64),Skip(Dtype.float16),], }, ] ), @@ -2810,6 +2835,18 @@ ), ), + 'bernoulli_int': dict( + name=['bernoulli'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "dtype": [Skip(Dtype.int64),Skip(Dtype.int32),Skip(Dtype.int16),Skip(Dtype.int8),Skip(Dtype.uint8),Skip(Dtype.bool),], + }, + ] + ), + ), + 'layer_norm': dict( name=['layer_norm'], tensor_para=dict( @@ -2840,13 +2877,27 @@ args=[ { "ins": ['input'], - "shape": [Skip((192, 147)),Skip((1, 1, 384)),Skip((2, 1, 38, 45)),], + "shape": [Skip(()),Skip((8,)),Skip((12,)),Skip((192, 147)),Skip((1, 1, 384)),Skip((2, 1, 38, 45)), + Skip((0,12)),Skip((12,0,9))], }, ] ), ), 'copy_different_dtype': dict( + name=['copy_'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "shape": [Skip((192, 147)),Skip((1, 1, 384)),Skip((2, 1, 38, 45)),Skip((100,100))], + "dtype": [Skip(Dtype.float32),Skip(Dtype.float64),], + }, + ] + ), + ), + + 'copy_broadcast': dict( name=['copy_'], tensor_para=dict( args=[ diff --git a/impl/camb/device_configs.py b/impl/camb/device_configs.py index 2a8138e5f..5cf46652f 100644 --- a/impl/camb/device_configs.py +++ b/impl/camb/device_configs.py @@ -585,7 +585,30 @@ "ins": ['input'], "dtype": [Skip(Dtype.float16), Skip(Dtype.float64), Skip(Dtype.float32)], }, + ], + ), + ), + + 'clamp_max_tensor': dict( + name=['clamp_max'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "dtype": [Skip(Dtype.float16), Skip(Dtype.float64), Skip(Dtype.float32)], + }, + ], + ), + ), + 'clamp_min_tensor': dict( + name=['clamp_min'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "dtype": [Skip(Dtype.float16), Skip(Dtype.float64), Skip(Dtype.float32)], + }, ], ), ), @@ -995,6 +1018,18 @@ ), ), + 'reciprocal_zero': dict( + name=["reciprocal"], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "dtype": [Skip(Dtype.float64)], + }, + ], + ), + ), + 'adam': dict( name=['adam', 'adamw'], tensor_para=dict( @@ -1013,19 +1048,15 @@ name=['cdist'], para=dict( # Currently, p must be equal 1.0 due to the limitation of Cambrian operator. - p=[Skip(2), Skip(0), Skip(0.5), Skip(float("inf"))], + p=[Skip(2), Skip(0), Skip(0.5), Skip(float("inf")), Skip(1.2)], ), ), 'cdist_compute_mode': dict( name=['cdist'], - tensor_para=dict( - args=[ - { - "ins": ['x1'], - "dtype": [Skip(Dtype.float32), Skip(Dtype.float64)], - }, - ], + para=dict( + # Currently, p must be equal 1.0 due to the limitation of Cambrian operator. + p=[Skip(2)], ), ), @@ -1150,27 +1181,37 @@ # rtol=1e-1 # ), - 'index_fill': dict( - name=['index_fill'], + 'mm_diff_dtype': dict( + name=['mm'], + interface=['torch'], tensor_para=dict( args=[ { "ins": ['input'], - "dtype": [Skip(Dtype.float64), Skip(Dtype.float32), Skip(Dtype.float16)], + "shape": (Skip((8, 0)),), }, - ] + ], + ), + ), + + 'expand': dict( + name=['expand'], + interface=['torch.Tensor'], + para=dict( + size=[Skip((0,))], ), ), - 'index_fill_scalar': dict( - name=['index_fill'], + 'permute': dict( + name=['permute'], + interface=['torch'], tensor_para=dict( args=[ { "ins": ['input'], - "dtype": [Skip(Dtype.float64), Skip(Dtype.float32), Skip(Dtype.float16)], + "shape": [Skip(())], }, - ] + ], ), ), @@ -1529,6 +1570,62 @@ ), ), + 'unfold': dict( + name=["unfold"], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "shape": (Skip(()),), + }, + ], + ), + ), + + 'pad': dict( + name=['pad'], + para=dict( + # Only supports 2D padding for reflection/replicate padding mode now + # pad should be greater than or equal to 0 + pad=[Skip((7, -14, 2, 3)), Skip((0, 1, -1, 3, 1, 2)), Skip((0, 2, -1, 1, 1, 5)),], + ), + tensor_para=dict( + args=[ + { + "ins": ['input'], + # input dims should be 4D for cnnlReflectionPad2d + "shape": [Skip((4, 5)),], + }, + ], + ), + ), + + 'constant_pad': dict( + name=['pad'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "shape": [Skip(())], + }, + ], + ), + ), + + 'unique': dict( + name=['unique'], + interface=['torch'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + # when dtype is float64, can't get the correct result + "shape": (Skip((4, 64, 128)),), + }, + ], + ), + ), + 'random': dict( name=['random'], tensor_para=dict( @@ -1562,6 +1659,31 @@ ), ), + 'bernoulli': dict( + name=['bernoulli'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "dtype": [Skip(Dtype.float64), Skip(Dtype.float32), Skip(Dtype.float16)], + }, + ], + ), + ), + + 'bernoulli_int': dict( + name=['bernoulli'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "dtype": [Skip(Dtype.int64), Skip(Dtype.int32), Skip(Dtype.int16), + Skip(Dtype.int8), Skip(Dtype.uint8), Skip(Dtype.bool)], + }, + ], + ), + ), + 'layer_norm': dict( name=["layer_norm"], atol=1e-4, @@ -1603,6 +1725,20 @@ ), 'copy_different_dtype': dict( + name=["copy_"], + tensor_para=dict( + args=[ + { + "ins": ["input"], + "dtype": [Skip(Dtype.float64), Skip(Dtype.float32), Skip(Dtype.float16), + Skip(Dtype.int64), Skip(Dtype.int32), Skip(Dtype.int16), + Skip(Dtype.int8), Skip(Dtype.uint8), Skip(Dtype.bool)], + }, + ] + ) + ), + + 'copy_broadcast': dict( name=["copy_"], tensor_para=dict( args=[ @@ -1629,6 +1765,44 @@ ) ), + 'tanh': dict( + name=['tanh'], + interface=['torch'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "shape": (Skip((0,)), Skip((16, 0)), Skip((1, 0, 6))), + }, + ], + ), + ), + + 'tanh_not_float': dict( + name=['tanh'], + interface=['torch'], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "shape": (Skip((0,)), Skip((16, 0)), Skip((1, 0, 6))), + }, + ], + ), + ), + + 'col2im': dict( + name=["col2im"], + tensor_para=dict( + args=[ + { + "ins": ['input'], + "shape": [Skip((2, 576, 46464))], + }, + ] + ), + ), + 'cholesky': dict( name=['cholesky_ex'], tensor_para=dict(