-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
feat: Add broadcast_tensors method to paddle.tensor.Tensor #26789
Conversation
Thank you for this PR, here is the CI results: This pull request does not result in any additional test failures. Congratulations! |
Hello @Fayad-Alman . |
hello @kurshakuz please review my pr |
@clsandoval. |
@kurshakuz hello, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Thank you for your contribution!
Your implementation is currently throwing the following error. Can you please resolve it?
+ Exception Group Traceback (most recent call last):
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/_pytest/runner.py", line 341, in from_call
| result: Optional[TResult] = func()
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/_pytest/runner.py", line 262, in <lambda>
| lambda: ihook(item=item, **kwds), when=when, reraise=reraise
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_hooks.py", line 493, in __call__
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_callers.py", line 152, in _multicall
| return outcome.get_result()
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_result.py", line 114, in get_result
| raise exc.with_traceback(exc.__traceback__)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/_pytest/runner.py", line 177, in pytest_runtest_call
| raise e
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/_pytest/runner.py", line 169, in pytest_runtest_call
| item.runtest()
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/_pytest/python.py", line 1792, in runtest
| self.ihook.pytest_pyfunc_call(pyfuncitem=self)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_hooks.py", line 493, in __call__
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.__traceback__)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/_pytest/python.py", line 194, in pytest_pyfunc_call
| result = testfunction(**testargs)
| File "/workspaces/ivy/ivy_tests/test_ivy/helpers/testing_helpers.py", line 896, in wrapped_test
| raise e
| File "/workspaces/ivy/ivy_tests/test_ivy/helpers/testing_helpers.py", line 889, in wrapped_test
| hypothesis_test_fn(*args, **kwargs)
| File "/workspaces/ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py", line 1286, in test_paddle_tensor_broadcast_tensors
| class_tree=CLASS_TREE,
| File "/opt/miniconda/envs/multienv/lib/python3.10/site-packages/hypothesis/core.py", line 1471, in wrapped_test
| raise the_error_hypothesis_found
| exceptiongroup.ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/workspaces/ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py", line 1303, in test_paddle_tensor_broadcast_tensors
| helpers.test_frontend_method(
| File "/workspaces/ivy/ivy_tests/test_ivy/helpers/function_testing.py", line 2210, in test_frontend_method
| frontend_ret = ins_gt.__getattribute__(frontend_method_data.method_name)(
| File "/opt/fw/paddle/paddle/tensor/manipulation.py", line 1230, in broadcast_tensors
| return _C_ops.broadcast_tensors(input)
| ValueError: (InvalidArgument) broadcast_tensors(): argument 'input' (position 0) must be list of Tensors, but got Tensor (at /paddle/paddle/fluid/pybind/eager_utils.cc:1080)
|
| Falsifying example: test_paddle_tensor_broadcast_tensors(
| frontend='paddle',
| on_device='cpu',
| backend_fw='paddle',
| dtype_and_x=(['float64'], [array([1.])]),
| method_flags=FrontendMethodTestFlags(
| num_positional_args=0,
| as_variable=[False],
| native_arrays=[False],
| precision_mode=False,
| inplace=False,
| test_trace=False,
| generate_frontend_arrays=False,
| ),
| frontend_method_data=FrontendMethodData(ivy_init_module='ivy.functional.frontends.paddle', framework_init_module='paddle', init_name='to_tensor', method_name='broadcast_tensors'),
| init_flags=FrontendInitTestFlags(
| num_positional_args=1,
| as_variable=[False],
| native_arrays=[False],
| ),
| )
|
| You can reproduce this example by temporarily adding @reproduce_failure('6.88.1', b'AXicY2BkYWBgFGVhZIACOIOBAQAC9wAi') as a decorator on your test case
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/workspaces/ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py", line 1303, in test_paddle_tensor_broadcast_tensors
| helpers.test_frontend_method(
| File "/workspaces/ivy/ivy_tests/test_ivy/helpers/function_testing.py", line 2210, in test_frontend_method
| frontend_ret = ins_gt.__getattribute__(frontend_method_data.method_name)(
| File "/opt/fw/paddle/paddle/tensor/manipulation.py", line 1228, in broadcast_tensors
| num_inputs = len(input)
| File "/opt/fw/paddle/paddle/fluid/dygraph/math_op_patch.py", line 134, in _len_
| assert var.ndim > 0, "len() of a 0-D tensor is wrong"
| AssertionError: len() of a 0-D tensor is wrong
| Falsifying example: test_paddle_tensor_broadcast_tensors(
| frontend='paddle',
| on_device='cpu',
| backend_fw='paddle',
| dtype_and_x=(['float64'], [array(-1.)]), # or any other generated value
| method_flags=FrontendMethodTestFlags(
| num_positional_args=0,
| as_variable=[False],
| native_arrays=[False],
| precision_mode=False,
| inplace=False,
| test_trace=False,
| generate_frontend_arrays=False,
| ),
| frontend_method_data=FrontendMethodData(ivy_init_module='ivy.functional.frontends.paddle', framework_init_module='paddle', init_name='to_tensor', method_name='broadcast_tensors'),
| init_flags=FrontendInitTestFlags(
| num_positional_args=1,
| as_variable=[False],
| native_arrays=[False],
| ),
| )
|
| You can reproduce this example by temporarily adding @reproduce_failure('6.88.1', b'AXicY2AAAkYGCIDRQAAAADYAAw==') as a decorator on your test case
Please request a review only once you resolved it and tested it locally. After doing so, please show the results of passing tests. Thanks!
dee0f6d
to
8d0ad81
Compare
@kurshakuz I have fixed the issue |
This PR has been labelled as stale because it has been inactive for more than 7 days. If you would like to continue working on this PR, then please add another comment or this PR will be closed in 7 days. |
Thank you very much for the PR. Closing this due to lack of activity with changes requested remaining unresolved for several months. Please feel free to reopen if you would like to continue working on this. :) |
PR Description
Changes Made
Added the
broadcast_tensors
function to thepaddle.tensor.tensor.Tensor
class and included the equivalent test case.Details
broadcast_tensors
method to enable broadcasting operations for tensors in thepaddle.tensor.tensor.Tensor
class.This PR enhances the capabilities of the
paddle.tensor.tensor.Tensor
class by introducing thebroadcast_tensors
method and ensures its correctness through testing.Related Issue
Close #25869
Checklist