Skip to content

[SWE-Paddle] Add task PaddlePaddle__Paddle-73855 - #1525

Open
co63oc wants to merge 1 commit into
PaddlePaddle:masterfrom
co63oc:pr73855
Open

[SWE-Paddle] Add task PaddlePaddle__Paddle-73855#1525
co63oc wants to merge 1 commit into
PaddlePaddle:masterfrom
co63oc:pr73855

Conversation

@co63oc

@co63oc co63oc commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

关联

说明

新增 SWE-Paddle 任务 PaddlePaddle__Paddle-73855

该任务覆盖 paddle.nn.functional.dice_loss 对 0-size Tensor 的处理。测试包含非 0-size Tensor regression case,以及 dice_loss 的目标场景,可在 CPU 环境运行。

验证结果

状态 P2P dice_loss F2P
Base + tests/test.patch PASS FAIL
Base + test patch + solution/code.patch PASS PASS

Base P2P

========================================================= 1 passed, 1 warning in 1.28s =========================================================

Base F2P:dice_loss

    def test_api_with_dygraph(self):
        for place in get_places():
            paddle.disable_static(place)
            input = paddle.randn([0, 2]).astype(paddle.float64)
            input.stop_gradient = False
            label = paddle.randn([0, 1]).astype(paddle.int64)
            label.stop_gradient = False
>           out = paddle.nn.functional.dice_loss(input, label, 1e-5)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

test_nn_dice_loss.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = Tensor(shape=[0, 2], dtype=float64, place=Place(cpu), stop_gradient=False, [])
label = Tensor(shape=[0, 1], dtype=int64, place=Place(cpu), stop_gradient=False, [])
epsilon = 1e-05, name = None

    def dice_loss(...):
        ...
        assert (
>           functools.reduce(operator.mul, input.shape) != 0
            and functools.reduce(operator.mul, label.shape) != 0
        ), "Any dimension of input and label cannot be equal to 0."
E       AssertionError: Any dimension of input and label cannot be equal to 0.

venv/lib/python3.12/site-packages/paddle/nn/functional/loss.py:114: AssertionError

Solution P2P

========================================================= 1 passed, 1 warning in 1.27s =========================================================

Solution F2P:dice_loss

========================================================= 1 passed, 1 warning in 1.20s =========================================================

@co63oc
co63oc force-pushed the pr73855 branch 2 times, most recently from d3d4a43 to d436ee1 Compare August 12, 2026 02:36
@co63oc
co63oc marked this pull request as ready for review August 12, 2026 02:49
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.

1 participant