Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【PIR API adaptor No.178、169、137、34、129】 Migrate ReLU6/PReLU/LogSigmoid/CELU/LogSoftmax into pir #58445

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

DrRyanHuang
Copy link
Member

@DrRyanHuang DrRyanHuang commented Oct 27, 2023

PR types

Others

PR changes

APIs

Description

No.178、169、137、34、129
PIR API 推全升级

将 PReLU 迁移升级至 pir,并更新单测 单测覆盖率:38/42
将 LogSigmoid 迁移升级至 pir,并更新单测 单测覆盖率:4/7
将 CELU 迁移升级至 pir,并更新单测 单测覆盖率:4/5
将 LogSoftmax 迁移升级至 pir,并更新单测 单测覆盖率:18/19
将 ReLU6 迁移升级至 pir,并更新单测 单测覆盖率:4/6

存在问题:

PReLU

======================================================================
ERROR: test_error (__main__.TestFunctionalPReluAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_prelu_op.py", line 90, in test_error
    self.assertRaises(TypeError, F.prelu, x=1, weight=weight_fp32)
  File "/usr/lib/python3.8/unittest/case.py", line 816, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "/usr/lib/python3.8/unittest/case.py", line 202, in handle
    callable_obj(*args, **kwargs)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/functional/activation.py", line 598, in prelu
    return _C_ops.prelu(x, weight, data_format, mode)
ValueError: (InvalidArgument) prelu(): argument (position 1) must be OpResult, but got int (at /home/aistudio/lbwnb/Paddle/paddle/fluid/pybind/eager_utils.cc:1530)


======================================================================
ERROR: test_data_format_error1 (__main__.TestModeError)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_prelu_op.py", line 528, in test_data_format_error1
    with base.program_guard(main_program, Program()):
  File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir/core.py", line 234, in program_guard
    check_type(
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/base/data_feeder.py", line 188, in check_type
    raise TypeError(
TypeError: The type of 'main_program' in paddle.static.program_guard must be <class 'paddle.base.libpaddle.pir.Program'>, but received <class 'paddle.base.framework.Program'>. 

======================================================================
ERROR: test_data_format_error2 (__main__.TestModeError)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_prelu_op.py", line 538, in test_data_format_error2
    with base.program_guard(main_program, Program()):
  File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir/core.py", line 234, in program_guard
    check_type(
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/base/data_feeder.py", line 188, in check_type
    raise TypeError(
TypeError: The type of 'main_program' in paddle.static.program_guard must be <class 'paddle.base.libpaddle.pir.Program'>, but received <class 'paddle.base.framework.Program'>. 

======================================================================
ERROR: test_mode_error (__main__.TestModeError)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_prelu_op.py", line 518, in test_mode_error
    with base.program_guard(main_program, Program()):
  File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir/core.py", line 234, in program_guard
    check_type(
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/base/data_feeder.py", line 188, in check_type
    raise TypeError(
TypeError: The type of 'main_program' in paddle.static.program_guard must be <class 'paddle.base.libpaddle.pir.Program'>, but received <class 'paddle.base.framework.Program'>. 

----------------------------------------------------------------------

LogSoftmax

======================================================================
FAIL: test_errors (__main__.TestNNFunctionalLogSoftmaxAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_log_softmax.py", line 243, in test_errors
    self.assertRaises(TypeError, F.log_softmax, x)
AssertionError: TypeError not raised by log_softmax

CELU

ERROR: test_errors (__main__.TestCELUAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_activation_op.py", line 3283, in test_errors
    self.assertRaises(TypeError, self.celu, 1)
  File "/usr/lib/python3.8/unittest/case.py", line 816, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "/usr/lib/python3.8/unittest/case.py", line 202, in handle
    callable_obj(*args, **kwargs)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/functional/activation.py", line 65, in celu
    return _C_ops.celu(x, alpha)
ValueError: (InvalidArgument) celu(): argument (position 1) must be OpResult, but got int (at /home/aistudio/lbwnb/Paddle/paddle/fluid/pybind/eager_utils.cc:1530)

LogSigmoid

ERROR: test_errors (__main__.TestLogSigmoidAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_activation_op.py", line 688, in test_errors
    self.assertRaises(TypeError, F.log_sigmoid, 1)
  File "/usr/lib/python3.8/unittest/case.py", line 816, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "/usr/lib/python3.8/unittest/case.py", line 202, in handle
    callable_obj(*args, **kwargs)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/functional/activation.py", line 817, in log_sigmoid
    return _C_ops.logsigmoid(x)
ValueError: (InvalidArgument) logsigmoid(): argument (position 1) must be OpResult, but got int (at /home/aistudio/lbwnb/Paddle/paddle/fluid/pybind/eager_utils.cc:1530)
ERROR: test_check_output (__main__.TestSigmoid_Complex64)
ERROR: test_check_output (__main__.TestSigmoid_Complex128)

    InvalidArgumentError: The type of data we are trying to retrieve (float32) does not match the type of data (complex64) currently contained in the container.
      [Hint: Expected dtype() == phi::CppTypeToDataType<T>::Type(), but received dtype():12 != phi::CppTypeToDataType<T>::Type():10.] (at /home/aistudio/lbwnb/Paddle/paddle/phi/core/dense_tensor.cc:171)
      [operator < sigmoid_grad_grad > error]

**ReLU6 **

ERROR: test_errors (__main__.TestRelu6API)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_activation_op.py", line 2855, in test_errors
    self.assertRaises(TypeError, F.relu6, 1)
  File "/usr/lib/python3.8/unittest/case.py", line 816, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "/usr/lib/python3.8/unittest/case.py", line 202, in handle
    callable_obj(*args, **kwargs)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/nn/functional/activation.py", line 946, in relu6
    return _C_ops.relu6(x)
ValueError: (InvalidArgument) relu6(): argument (position 1) must be OpResult, but got int (at /home/aistudio/lbwnb/Paddle/paddle/fluid/pybind/eager_utils.cc:1530)


======================================================================
ERROR: test_warnings (__main__.TestRelu6APIWarnings)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir_utils.py", line 119, in impl
    func(*args, **kwargs)
  File "test/legacy_test/test_activation_op.py", line 2879, in test_warnings
    out = helper.create_variable_for_type_inference(
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/base/layer_helper_base.py", line 466, in create_variable_for_type_inference
    return self.main_program.current_block().create_var(
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/base/framework.py", line 4176, in create_var
    var = Variable(block=self, *args, **kwargs)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/base/framework.py", line 1449, in __init__
    dtype = convert_np_dtype_to_dtype_(dtype)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/base/framework.py", line 1151, in convert_np_dtype_to_dtype_
    return pir.core.convert_np_dtype_to_dtype_(np_dtype)
  File "/home/aistudio/.local/lib/python3.8/site-packages/paddle/pir/core.py", line 75, in convert_np_dtype_to_dtype_
    dtype = np.dtype(np_dtype)
TypeError: Cannot interpret '<DataType.FLOAT32: 10>' as a data type

@paddle-bot
Copy link

paddle-bot bot commented Oct 27, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Oct 27, 2023
Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@YuanRisheng YuanRisheng merged commit 89c8a59 into PaddlePaddle:develop Oct 30, 2023
28 checks passed
@DrRyanHuang DrRyanHuang deleted the ReLU6 branch October 30, 2023 03:03
@paddle-bot paddle-bot bot removed the contributor External developers label Nov 3, 2023
zeroRains pushed a commit to zeroRains/Paddle that referenced this pull request Nov 8, 2023
…d/CELU/LogSoftmax into pir (PaddlePaddle#58445)

* 178, 169, 137, 34, 129

* remove wrong test
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
…d/CELU/LogSoftmax into pir (PaddlePaddle#58445)

* 178, 169, 137, 34, 129

* remove wrong test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants