From 35b1a948b3542c3be8d4a9cae554b26da6bdc7f7 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Tue, 21 Mar 2023 18:09:40 +0800 Subject: [PATCH 01/10] add fmax BF16 test --- .../fluid/tests/unittests/test_fmax_op.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/python/paddle/fluid/tests/unittests/test_fmax_op.py b/python/paddle/fluid/tests/unittests/test_fmax_op.py index 9ecda0b8d72e9..559b8dc8fa3c9 100644 --- a/python/paddle/fluid/tests/unittests/test_fmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_fmax_op.py @@ -241,5 +241,34 @@ def test_check_grad_normal(self): self.check_grad(['X', 'Y'], 'Out') +@unittest.skipIf( + not core.is_compiled_with_cuda() + or not core.is_bfloat16_supported(core.CUDAPlace(0)), + "core is not complied with CUDA and not support the bfloat16", +) +class TestFmaxBF16OP(OpTest): + def setUp(self): + self.op_type = "elementwise_fmax" + self.python_api = paddle.fmax + self.dtype = np.uint16 + self.inputs = { + 'X': np.random.randn(11, 17).astype(self.dtype), + 'Y': np.random.randn(11, 17).astype(self.dtype), + } + self.outputs = {'Out': np.fmax(self.inputs['X'], self.inputs['Y'])} + + def test_check_output(self): + if core.is_compiled_with_cuda(): + place = core.CUDAPlace(0) + if core.is_bfloat16_supported(place): + self.check_output_with_place(place) + + def test_check_grad(self): + if core.is_compiled_with_cuda(): + place = core.CUDAPlace(0) + if core.is_bfloat16_supported(place): + self.check_grad_with_place(place, ['X', 'Y'], 'Out') + + if __name__ == "__main__": unittest.main() From cc1b289829d97300bdde372d858967c9b2e13828 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Wed, 22 Mar 2023 09:59:39 +0800 Subject: [PATCH 02/10] fix --- paddle/phi/kernels/elementwise_kernel.h | 1 + paddle/phi/kernels/gpu/elementwise_grad_kernel.cu | 1 + python/paddle/fluid/tests/unittests/test_fmax_op.py | 12 ++++-------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/paddle/phi/kernels/elementwise_kernel.h b/paddle/phi/kernels/elementwise_kernel.h index 3bc4163d59e71..0593d4cfc6723 100644 --- a/paddle/phi/kernels/elementwise_kernel.h +++ b/paddle/phi/kernels/elementwise_kernel.h @@ -15,6 +15,7 @@ #pragma once #include "paddle/phi/core/dense_tensor.h" +#include "paddle/phi/core/device_context.h" #include "paddle/phi/infermeta/binary.h" namespace phi { diff --git a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu index 2e3a5680d4a3f..1ebf705de5634 100644 --- a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu +++ b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu @@ -98,6 +98,7 @@ PD_REGISTER_KERNEL(fmax_grad, double, int, phi::dtype::float16, + phi::dtype::bfloat16, int64_t) {} PD_REGISTER_KERNEL(fmin_grad, diff --git a/python/paddle/fluid/tests/unittests/test_fmax_op.py b/python/paddle/fluid/tests/unittests/test_fmax_op.py index 559b8dc8fa3c9..68e3d984878da 100644 --- a/python/paddle/fluid/tests/unittests/test_fmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_fmax_op.py @@ -258,16 +258,12 @@ def setUp(self): self.outputs = {'Out': np.fmax(self.inputs['X'], self.inputs['Y'])} def test_check_output(self): - if core.is_compiled_with_cuda(): - place = core.CUDAPlace(0) - if core.is_bfloat16_supported(place): - self.check_output_with_place(place) + place = core.CUDAPlace(0) + self.check_output_with_place(place) def test_check_grad(self): - if core.is_compiled_with_cuda(): - place = core.CUDAPlace(0) - if core.is_bfloat16_supported(place): - self.check_grad_with_place(place, ['X', 'Y'], 'Out') + place = core.CUDAPlace(0) + self.check_grad_with_place(place, ['X', 'Y'], 'Out') if __name__ == "__main__": From 2a3c58ebadbcce19de60b2babd744543702735e8 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:11:21 +0800 Subject: [PATCH 03/10] fix --- paddle/phi/kernels/elementwise_kernel.h | 1 - .../kernels/gpu/elementwise_grad_kernel.cu | 1 - .../fluid/tests/unittests/test_fmax_op.py | 28 ++++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/paddle/phi/kernels/elementwise_kernel.h b/paddle/phi/kernels/elementwise_kernel.h index 0593d4cfc6723..3bc4163d59e71 100644 --- a/paddle/phi/kernels/elementwise_kernel.h +++ b/paddle/phi/kernels/elementwise_kernel.h @@ -15,7 +15,6 @@ #pragma once #include "paddle/phi/core/dense_tensor.h" -#include "paddle/phi/core/device_context.h" #include "paddle/phi/infermeta/binary.h" namespace phi { diff --git a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu index 1ebf705de5634..2e3a5680d4a3f 100644 --- a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu +++ b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu @@ -98,7 +98,6 @@ PD_REGISTER_KERNEL(fmax_grad, double, int, phi::dtype::float16, - phi::dtype::bfloat16, int64_t) {} PD_REGISTER_KERNEL(fmin_grad, diff --git a/python/paddle/fluid/tests/unittests/test_fmax_op.py b/python/paddle/fluid/tests/unittests/test_fmax_op.py index 68e3d984878da..e7115197accd6 100644 --- a/python/paddle/fluid/tests/unittests/test_fmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_fmax_op.py @@ -15,7 +15,7 @@ import unittest import numpy as np -from eager_op_test import OpTest +from eager_op_test import OpTest, convert_float_to_uint16 import paddle import paddle.fluid.core as core @@ -241,29 +241,31 @@ def test_check_grad_normal(self): self.check_grad(['X', 'Y'], 'Out') -@unittest.skipIf( - not core.is_compiled_with_cuda() - or not core.is_bfloat16_supported(core.CUDAPlace(0)), - "core is not complied with CUDA and not support the bfloat16", -) class TestFmaxBF16OP(OpTest): def setUp(self): self.op_type = "elementwise_fmax" self.python_api = paddle.fmax self.dtype = np.uint16 + x = np.random.randn(11, 17).astype('float32') + y = np.random.randn(11, 17).astype('float32') + out = np.fmax(x, y) self.inputs = { - 'X': np.random.randn(11, 17).astype(self.dtype), - 'Y': np.random.randn(11, 17).astype(self.dtype), + 'X': convert_float_to_uint16(x), + 'Y': convert_float_to_uint16(y), } - self.outputs = {'Out': np.fmax(self.inputs['X'], self.inputs['Y'])} + self.outputs = {'Out': convert_float_to_uint16(out)} def test_check_output(self): - place = core.CUDAPlace(0) - self.check_output_with_place(place) + if core.is_compiled_with_cuda(): + place = core.CUDAPlace(0) + if core.is_bfloat16_supported(place): + self.check_output_with_place(place) def test_check_grad(self): - place = core.CUDAPlace(0) - self.check_grad_with_place(place, ['X', 'Y'], 'Out') + if core.is_compiled_with_cuda(): + place = core.CUDAPlace(0) + if core.is_bfloat16_supported(place): + self.check_grad_with_place(place, ['X', 'Y'], 'Out') if __name__ == "__main__": From dce7c866db8a5c188c1e6d95b30e76e414c95ed8 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Wed, 22 Mar 2023 23:21:39 +0800 Subject: [PATCH 04/10] fix --- .../fluid/tests/unittests/test_fmax_op.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_fmax_op.py b/python/paddle/fluid/tests/unittests/test_fmax_op.py index e7115197accd6..87679314af5e2 100644 --- a/python/paddle/fluid/tests/unittests/test_fmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_fmax_op.py @@ -241,6 +241,11 @@ def test_check_grad_normal(self): self.check_grad(['X', 'Y'], 'Out') +@unittest.skipIf( + not core.is_compiled_with_cuda() + or not core.is_bfloat16_supported(core.CUDAPlace(0)), + "core is not compiled with CUDA and not support the bfloat16", +) class TestFmaxBF16OP(OpTest): def setUp(self): self.op_type = "elementwise_fmax" @@ -256,16 +261,12 @@ def setUp(self): self.outputs = {'Out': convert_float_to_uint16(out)} def test_check_output(self): - if core.is_compiled_with_cuda(): - place = core.CUDAPlace(0) - if core.is_bfloat16_supported(place): - self.check_output_with_place(place) + place = core.CUDAPlace(0) + self.check_output_with_place(place) def test_check_grad(self): - if core.is_compiled_with_cuda(): - place = core.CUDAPlace(0) - if core.is_bfloat16_supported(place): - self.check_grad_with_place(place, ['X', 'Y'], 'Out') + place = core.CUDAPlace(0) + self.check_grad_with_place(place, ['X', 'Y'], 'Out') if __name__ == "__main__": From cf109932191e6f02d948b96a00e9524467d0abc2 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:45:38 +0800 Subject: [PATCH 05/10] fix --- paddle/phi/kernels/cpu/elementwise_grad_kernel.cc | 3 ++- paddle/phi/kernels/gpu/elementwise_grad_kernel.cu | 1 + paddle/phi/kernels/kps/elementwise_kernel.cu | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/paddle/phi/kernels/cpu/elementwise_grad_kernel.cc b/paddle/phi/kernels/cpu/elementwise_grad_kernel.cc index 6b7f1aa3ee61d..da01fe605a66f 100644 --- a/paddle/phi/kernels/cpu/elementwise_grad_kernel.cc +++ b/paddle/phi/kernels/cpu/elementwise_grad_kernel.cc @@ -58,7 +58,8 @@ PD_REGISTER_KERNEL(fmax_grad, float, double, int, - int64_t) {} + int64_t, + phi::dtype::bfloat16) {} PD_REGISTER_KERNEL(fmin_grad, CPU, diff --git a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu index 4ff1164e64e08..48a86bed1a4e1 100644 --- a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu +++ b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu @@ -98,6 +98,7 @@ PD_REGISTER_KERNEL(fmax_grad, double, int, phi::dtype::float16, + phi::dtype::bfloat16, int64_t) {} PD_REGISTER_KERNEL(fmin_grad, diff --git a/paddle/phi/kernels/kps/elementwise_kernel.cu b/paddle/phi/kernels/kps/elementwise_kernel.cu index 245137943d571..3d0cb1f5f9901 100644 --- a/paddle/phi/kernels/kps/elementwise_kernel.cu +++ b/paddle/phi/kernels/kps/elementwise_kernel.cu @@ -117,6 +117,7 @@ PD_REGISTER_KERNEL(fmax, double, int, float16, + bfloat16, int64_t) {} PD_REGISTER_KERNEL(fmin, From ccd19f5162c97410d80f8a376bdea7a435288265 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Thu, 23 Mar 2023 16:54:57 +0800 Subject: [PATCH 06/10] fix --- paddle/phi/kernels/cpu/elementwise_grad_kernel.cc | 3 +-- paddle/phi/kernels/gpu/elementwise_grad_kernel.cu | 1 - paddle/phi/kernels/kps/elementwise_kernel.cu | 1 - python/paddle/fluid/tests/unittests/test_fmax_op.py | 6 ++---- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/paddle/phi/kernels/cpu/elementwise_grad_kernel.cc b/paddle/phi/kernels/cpu/elementwise_grad_kernel.cc index da01fe605a66f..6b7f1aa3ee61d 100644 --- a/paddle/phi/kernels/cpu/elementwise_grad_kernel.cc +++ b/paddle/phi/kernels/cpu/elementwise_grad_kernel.cc @@ -58,8 +58,7 @@ PD_REGISTER_KERNEL(fmax_grad, float, double, int, - int64_t, - phi::dtype::bfloat16) {} + int64_t) {} PD_REGISTER_KERNEL(fmin_grad, CPU, diff --git a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu index 48a86bed1a4e1..4ff1164e64e08 100644 --- a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu +++ b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu @@ -98,7 +98,6 @@ PD_REGISTER_KERNEL(fmax_grad, double, int, phi::dtype::float16, - phi::dtype::bfloat16, int64_t) {} PD_REGISTER_KERNEL(fmin_grad, diff --git a/paddle/phi/kernels/kps/elementwise_kernel.cu b/paddle/phi/kernels/kps/elementwise_kernel.cu index 3d0cb1f5f9901..245137943d571 100644 --- a/paddle/phi/kernels/kps/elementwise_kernel.cu +++ b/paddle/phi/kernels/kps/elementwise_kernel.cu @@ -117,7 +117,6 @@ PD_REGISTER_KERNEL(fmax, double, int, float16, - bfloat16, int64_t) {} PD_REGISTER_KERNEL(fmin, diff --git a/python/paddle/fluid/tests/unittests/test_fmax_op.py b/python/paddle/fluid/tests/unittests/test_fmax_op.py index 87679314af5e2..7fe6d8a47edd7 100644 --- a/python/paddle/fluid/tests/unittests/test_fmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_fmax_op.py @@ -261,12 +261,10 @@ def setUp(self): self.outputs = {'Out': convert_float_to_uint16(out)} def test_check_output(self): - place = core.CUDAPlace(0) - self.check_output_with_place(place) + self.check_output() def test_check_grad(self): - place = core.CUDAPlace(0) - self.check_grad_with_place(place, ['X', 'Y'], 'Out') + self.check_grad(['X', 'Y'], 'Out') if __name__ == "__main__": From 211832868e05a7ee7d8b5405eaa0080a5fc1c972 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:18:27 +0800 Subject: [PATCH 07/10] fix --- .../phi/kernels/funcs/elementwise_functor.h | 31 +++++++++++++++++++ .../kernels/gpu/elementwise_grad_kernel.cu | 1 + paddle/phi/kernels/kps/elementwise_kernel.cu | 1 + 3 files changed, 33 insertions(+) diff --git a/paddle/phi/kernels/funcs/elementwise_functor.h b/paddle/phi/kernels/funcs/elementwise_functor.h index 3543c0c6aa066..84bea2137ebb3 100644 --- a/paddle/phi/kernels/funcs/elementwise_functor.h +++ b/paddle/phi/kernels/funcs/elementwise_functor.h @@ -228,6 +228,17 @@ struct FMaxFunctor { } }; +template <> +struct FMaxFunctor { + inline HOSTDEVICE dtype::bfloat16 operator()(const dtype::bfloat16 a, + const dtype::bfloat16 b) const { + float float_a = static_cast(a); + float float_b = static_cast(b); + auto result = std::fmax(float_a, float_b); + return static_cast(result); + } +}; + template <> struct FMaxFunctor { inline HOSTDEVICE int operator()(const int a, const int b) const { @@ -265,6 +276,16 @@ struct FMaxGradDx { } }; +template <> +struct FMaxGradDx { + HOSTDEVICE dtype::bfloat16 operator()(dtype::bfloat16 x, + dtype::bfloat16 y, + dtype::bfloat16 out, + dtype::bfloat16 dout) const { + return dout * static_cast((x >= y) || dtype::isnan(y)); + } +}; + template <> struct FMaxGradDx { HOSTDEVICE int operator()(int x, int y, int out, int dout) const { @@ -299,6 +320,16 @@ struct FMaxGradDy { } }; +template <> +struct FMaxGradDy { + HOSTDEVICE dtype::bfloat16 operator()(dtype::bfloat16 x, + dtype::bfloat16 y, + dtype::bfloat16 out, + dtype::bfloat16 dout) const { + return dout * static_cast(!((x >= y) || dtype::isnan(y))); + } +}; + template <> struct FMaxGradDy { HOSTDEVICE int64_t operator()(int64_t x, diff --git a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu index 4ff1164e64e08..48a86bed1a4e1 100644 --- a/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu +++ b/paddle/phi/kernels/gpu/elementwise_grad_kernel.cu @@ -98,6 +98,7 @@ PD_REGISTER_KERNEL(fmax_grad, double, int, phi::dtype::float16, + phi::dtype::bfloat16, int64_t) {} PD_REGISTER_KERNEL(fmin_grad, diff --git a/paddle/phi/kernels/kps/elementwise_kernel.cu b/paddle/phi/kernels/kps/elementwise_kernel.cu index 245137943d571..3d0cb1f5f9901 100644 --- a/paddle/phi/kernels/kps/elementwise_kernel.cu +++ b/paddle/phi/kernels/kps/elementwise_kernel.cu @@ -117,6 +117,7 @@ PD_REGISTER_KERNEL(fmax, double, int, float16, + bfloat16, int64_t) {} PD_REGISTER_KERNEL(fmin, From 147130a9b210c102e3bda702228d56351e88e450 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Sat, 25 Mar 2023 15:41:26 +0800 Subject: [PATCH 08/10] fix --- paddle/phi/kernels/funcs/elementwise_functor.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/paddle/phi/kernels/funcs/elementwise_functor.h b/paddle/phi/kernels/funcs/elementwise_functor.h index 84bea2137ebb3..dbd1274419158 100644 --- a/paddle/phi/kernels/funcs/elementwise_functor.h +++ b/paddle/phi/kernels/funcs/elementwise_functor.h @@ -231,7 +231,7 @@ struct FMaxFunctor { template <> struct FMaxFunctor { inline HOSTDEVICE dtype::bfloat16 operator()(const dtype::bfloat16 a, - const dtype::bfloat16 b) const { + const dtype::bfloat16 b) const { float float_a = static_cast(a); float float_b = static_cast(b); auto result = std::fmax(float_a, float_b); @@ -279,9 +279,9 @@ struct FMaxGradDx { template <> struct FMaxGradDx { HOSTDEVICE dtype::bfloat16 operator()(dtype::bfloat16 x, - dtype::bfloat16 y, - dtype::bfloat16 out, - dtype::bfloat16 dout) const { + dtype::bfloat16 y, + dtype::bfloat16 out, + dtype::bfloat16 dout) const { return dout * static_cast((x >= y) || dtype::isnan(y)); } }; @@ -323,9 +323,9 @@ struct FMaxGradDy { template <> struct FMaxGradDy { HOSTDEVICE dtype::bfloat16 operator()(dtype::bfloat16 x, - dtype::bfloat16 y, - dtype::bfloat16 out, - dtype::bfloat16 dout) const { + dtype::bfloat16 y, + dtype::bfloat16 out, + dtype::bfloat16 dout) const { return dout * static_cast(!((x >= y) || dtype::isnan(y))); } }; From b743f2ee8b3b3492ff4275b650c4b5146bd6ec32 Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Tue, 18 Apr 2023 23:07:19 +0800 Subject: [PATCH 09/10] 'fix' --- .../phi/kernels/funcs/elementwise_functor.h | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/paddle/phi/kernels/funcs/elementwise_functor.h b/paddle/phi/kernels/funcs/elementwise_functor.h index dbd1274419158..979e0e4e70d99 100644 --- a/paddle/phi/kernels/funcs/elementwise_functor.h +++ b/paddle/phi/kernels/funcs/elementwise_functor.h @@ -276,16 +276,6 @@ struct FMaxGradDx { } }; -template <> -struct FMaxGradDx { - HOSTDEVICE dtype::bfloat16 operator()(dtype::bfloat16 x, - dtype::bfloat16 y, - dtype::bfloat16 out, - dtype::bfloat16 dout) const { - return dout * static_cast((x >= y) || dtype::isnan(y)); - } -}; - template <> struct FMaxGradDx { HOSTDEVICE int operator()(int x, int y, int out, int dout) const { @@ -320,16 +310,6 @@ struct FMaxGradDy { } }; -template <> -struct FMaxGradDy { - HOSTDEVICE dtype::bfloat16 operator()(dtype::bfloat16 x, - dtype::bfloat16 y, - dtype::bfloat16 out, - dtype::bfloat16 dout) const { - return dout * static_cast(!((x >= y) || dtype::isnan(y))); - } -}; - template <> struct FMaxGradDy { HOSTDEVICE int64_t operator()(int64_t x, From cb18f4473fdc2b10c875187fda2eab031658ec0e Mon Sep 17 00:00:00 2001 From: superwinner1 <82640284+superwinner1@users.noreply.github.com> Date: Wed, 19 Apr 2023 10:26:33 +0800 Subject: [PATCH 10/10] 'fix' --- python/paddle/fluid/tests/unittests/test_fmax_op.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_fmax_op.py b/python/paddle/fluid/tests/unittests/test_fmax_op.py index 7fe6d8a47edd7..6d74c5dcbf239 100644 --- a/python/paddle/fluid/tests/unittests/test_fmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_fmax_op.py @@ -251,8 +251,9 @@ def setUp(self): self.op_type = "elementwise_fmax" self.python_api = paddle.fmax self.dtype = np.uint16 - x = np.random.randn(11, 17).astype('float32') - y = np.random.randn(11, 17).astype('float32') + x = np.random.uniform(0.1, 1, [13, 17]).astype("float32") + sgn = np.random.choice([-1, 1], [13, 17]).astype("float32") + y = x + sgn * np.random.uniform(0.1, 1, [13, 17]).astype("float32") out = np.fmax(x, y) self.inputs = { 'X': convert_float_to_uint16(x), @@ -261,10 +262,12 @@ def setUp(self): self.outputs = {'Out': convert_float_to_uint16(out)} def test_check_output(self): - self.check_output() + place = core.CUDAPlace(0) + self.check_output_with_place(place) def test_check_grad(self): - self.check_grad(['X', 'Y'], 'Out') + place = core.CUDAPlace(0) + self.check_grad_with_place(place, ['X', 'Y'], 'Out') if __name__ == "__main__":