Skip to content

[SWE-Paddle] Complete task package for PaddlePaddle__Paddle-78220 - #1469

Open
Manfredss wants to merge 2 commits into
PaddlePaddle:masterfrom
Manfredss:swe-paddle-78220-full
Open

[SWE-Paddle] Complete task package for PaddlePaddle__Paddle-78220#1469
Manfredss wants to merge 2 commits into
PaddlePaddle:masterfrom
Manfredss:swe-paddle-78220-full

Conversation

@Manfredss

Copy link
Copy Markdown
Contributor

关联

说明

  • 新增 SWE-Paddle 任务 PaddlePaddle__Paddle-78220

@sunzhongkai588 Thx

验证结果

# 修复前 F2P
λ /workspace/Paddle python3.10 test/legacy_test/test_compat_log_softmax.py
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
EW0804 07:18:05.234004 12215 gpu_resources.cc:116] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.6, Runtime API Version: 11.8
EEEEEEEEEEEEEEEEEEE
======================================================================
ERROR: test_dygraph_Compatibility (__main__.TestCompatLogSoftmaxAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspace/Paddle/test/legacy_test/test_compat_log_softmax.py", line 204, in test_dygraph_Compatibility
    compat_fn = paddle.compat.nn.functional.log_softmax
AttributeError: module 'paddle.compat.nn.functional' has no attribute 'log_softmax'

----------------------------------------------------------------------
Ran 20 tests in 0.258s

FAILED (errors=20)

# 修复前 F2P & P2P
λ /workspace/Paddle python3.10 test/legacy_test/test_log_softmax.py
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
I0804 07:19:12.019021 12742 program_interpreter.cc:255] New Executor is Running.
W0804 07:19:12.019291 12742 gpu_resources.cc:116] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.6, Runtime API Version: 11.8
======================================================================
ERROR: test_out_param_with_dim_alias (__main__.TestLogSoftmaxOutParam)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspace/Paddle/test/legacy_test/test_log_softmax.py", line 415, in test_out_param_with_dim_alias
    F.log_softmax(x, dim=0, out=out)
TypeError: log_softmax() got an unexpected keyword argument 'dim'

======================================================================
ERROR: test_out_param_with_dtype (__main__.TestLogSoftmaxOutParam)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspace/Paddle/test/legacy_test/test_log_softmax.py", line 421, in test_out_param_with_dtype
    F.log_softmax(x, axis=-1, dtype='float64', out=out)
TypeError: log_softmax() got an unexpected keyword argument 'out'
======================================================================
ERROR: test_3d_input_alias_dim1 (__main__.TestLogSoftmaxParamAlias)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspace/Paddle/test/legacy_test/test_log_softmax.py", line 362, in test_3d_input_alias_dim1
    result = F.log_softmax(input=x, dim=1).numpy()
TypeError: log_softmax() got an unexpected keyword argument 'input'

----------------------------------------------------------------------
Ran 39 tests in 3.322s

FAILED (errors=15)


# 修复后 F2P
λ /workspace/Paddle python3.10 test/legacy_test/test_compat_log_softmax.py
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
W0804 07:24:11.609820 14813 gpu_resources.cc:116] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.6, Runtime API Version: 11.8
........../usr/local/lib/python3.10/dist-packages/paddle/utils/decorator_utils.py:60: UserWarning: The API 'paddle.compat.nn.functional.log_softmax' may behave differently from its PyTorch counterpart. Refer to the compatibility guide for details:
https://www.paddlepaddle.org.cn/documentation/docs/en/develop/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.nn.functional.log_softmax.html
  processed_args, processed_kwargs = self.process(args, kwargs)
.....W0804 07:24:11.823242 14813 eager_utils.cc:3618] Paddle static graph(PIR) not support input out tensor for now!!!!!
I0804 07:24:11.830507 14813 pir_interpreter.cc:1528] New Executor is Running ...
I0804 07:24:11.831312 14813 pir_interpreter.cc:1551] pir interpreter is running by multi-thread mode ...
.....
----------------------------------------------------------------------
Ran 20 tests in 0.424s

OK

# 修复后 F2P & P2P
λ /workspace/Paddle python3.10 test/legacy_test/test_log_softmax.py
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
I0804 07:24:54.753885 15208 program_interpreter.cc:255] New Executor is Running.
W0804 07:24:54.754173 15208 gpu_resources.cc:116] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.6, Runtime API Version: 11.8
----------------------------------------------------------------------
Ran 39 tests in 2.941s

OK

Package the merged API compatibility change with exact solution and test patches, direct-Python verification, and reproducible environment guidance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the rank-dependent compatibility default dimension separately from
Paddle's native axis default, and keep the package metadata consistent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@@ -0,0 +1,43 @@
# Add compatible `log_softmax` public APIs

Implement `log_softmax` so that Paddle's standard and compatibility-facing public APIs expose consistent behavior without regressing the existing operator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

compatibility-facing public APIs 是啥意思

- `paddle.special.log_softmax`
- `paddle.compat.nn.functional.log_softmax`

When the dimension is explicitly specified with equivalent `axis`/`dim` values, all five routes must produce numerically equivalent results. The routes do not need to produce the same result when the dimension is omitted: `paddle.nn.functional.log_softmax` keeps Paddle's default `axis=-1`, while the compatibility-style routes use the PyTorch-compatible `dim=None` rule, which selects a dimension based on the input rank.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

while the compatibility-style routes use...

compatibility-style routes 是指 paddle.compat.nn.functional.log_softmax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants