From 57518d3597469003c433fc8420bdf1c3dee4ee49 Mon Sep 17 00:00:00 2001 From: z37903589 <379035389@qq.com> Date: Thu, 6 Apr 2023 14:45:31 +0800 Subject: [PATCH 1/3] add normalize --- diopirt | 2 +- impl | 2 +- python/conformance/diopi_configs.py | 18 ++++++++++++++++++ python/conformance/diopi_functions.py | 8 ++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/diopirt b/diopirt index 67685af..b1c1e40 160000 --- a/diopirt +++ b/diopirt @@ -1 +1 @@ -Subproject commit 67685af6f663ecb5ef0ce08976efb1c062f49fc8 +Subproject commit b1c1e40c4ae87511669e24ce5581dd9c2e6d4b04 diff --git a/impl b/impl index 6d198d8..cdb3c65 160000 --- a/impl +++ b/impl @@ -1 +1 @@ -Subproject commit 6d198d8b92c283c9c99f7c2134e28a8feb76ab87 +Subproject commit cdb3c654b15bedf6e676a933aa62686cc54e4c21 diff --git a/python/conformance/diopi_configs.py b/python/conformance/diopi_configs.py index e733c2a..906815b 100644 --- a/python/conformance/diopi_configs.py +++ b/python/conformance/diopi_configs.py @@ -4092,4 +4092,22 @@ ), ), + 'normalize': dict( + name=["normalize"], + para=dict( + p=[2.0, 1.0, 0, 1.5], + dim=[1, 2, -1, 0], + eps=[1e-12, 1e-12, 1e-11, 1e-12], + ), + tensor_para=dict( + args=[ + { + "ins": ['input'], + "shape": ((256, 256, 3, 3), (256, 128, 1, 1), (64, 32, 16), (32, 8)), + "dtype": [Dtype.float32, Dtype.float64], + } + ] + ) + ), + } diff --git a/python/conformance/diopi_functions.py b/python/conformance/diopi_functions.py index f59487c..c8e5213 100644 --- a/python/conformance/diopi_functions.py +++ b/python/conformance/diopi_functions.py @@ -3432,3 +3432,11 @@ def normal(mean, std, size=None): ret = func(out.context_handle, out.tensor_handle, arg_mean, arg_std) check_returncode(ret) return out + +def normalize(input, p, dim, eps): + call = "diopiNormalize" + func = check_function(call) + out = raw_like(input) + ret = func(input.context_handle, out.tensor_handle, input.tensor_handle, c_double(p), c_int64(dim), c_double(eps)) + check_returncode(ret) + return out \ No newline at end of file From e9eb6305fbf95721e0e33209d8bbb9ce8b1e4510 Mon Sep 17 00:00:00 2001 From: z37903589 <379035389@qq.com> Date: Fri, 7 Apr 2023 13:43:21 +0800 Subject: [PATCH 2/3] fix lint --- python/conformance/diopi_functions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/conformance/diopi_functions.py b/python/conformance/diopi_functions.py index c8e5213..1a89cf9 100644 --- a/python/conformance/diopi_functions.py +++ b/python/conformance/diopi_functions.py @@ -3433,10 +3433,11 @@ def normal(mean, std, size=None): check_returncode(ret) return out + def normalize(input, p, dim, eps): call = "diopiNormalize" func = check_function(call) out = raw_like(input) ret = func(input.context_handle, out.tensor_handle, input.tensor_handle, c_double(p), c_int64(dim), c_double(eps)) check_returncode(ret) - return out \ No newline at end of file + return out From 0e3de9267a184ac5a0fad2f707cd638a9a33be56 Mon Sep 17 00:00:00 2001 From: z37903589 <379035389@qq.com> Date: Fri, 7 Apr 2023 13:44:44 +0800 Subject: [PATCH 3/3] update --- impl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impl b/impl index cdb3c65..6fa4153 160000 --- a/impl +++ b/impl @@ -1 +1 @@ -Subproject commit cdb3c654b15bedf6e676a933aa62686cc54e4c21 +Subproject commit 6fa415374d405065ed2e739e663b2d0e341aae48