Skip to content

Conversation

@DrRyanHuang
Copy link
Contributor

@DrRyanHuang DrRyanHuang commented Nov 3, 2025

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

动转静会在进入 run_program 之前,将所有的 Tensor,统一转化为 pir.Value

import paddle
from paddle import nn

class Net(nn.Layer):
    def __init__(self):
        super().__init__()
        self.layer = nn.Linear(8, 8)

    @paddle.jit.marker.capture_control_flow
    def fn(self, x):
        if x.sum() > 0:
            x = self.layer(x)
            x += paddle.ones_like(x)
        else:
            x = self.layer(x)
            x -= paddle.zeros_like(x)
        return x

    @paddle.jit.to_static(backend=None)
    def forward(self, x):
        return self.fn(x) + 1

if __name__ == "__main__":
    paddle.seed(101)
    model = Net()
    print("model", model)
    input_data = paddle.rand([2, 8])
    output = model(input_data)
    print(output)

上述例子中的,model.layer.weight 存在未被转化的情况

TODO:

  • 后续请 @SigureMo 分享一下动转静 Tensor 转化为 pir.Value 的策略喵~

@DrRyanHuang DrRyanHuang requested a review from SigureMo November 3, 2025 13:56
@paddle-bot
Copy link

paddle-bot bot commented Nov 3, 2025

你的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.

@SigureMo SigureMo changed the title [Dy2St] Fix EagerParamBase not transform to pir.Value [SOT] Fix EagerParamBase not transform to pir.Value Nov 3, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@8e2251f). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #76198   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         5           
  Lines              ?        31           
  Branches           ?         0           
===========================================
  Hits               ?        31           
  Misses             ?         0           
  Partials           ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SigureMo SigureMo changed the title [SOT] Fix EagerParamBase not transform to pir.Value [SOT] Ensure run AST transformed function under graph_tracing_guard Nov 4, 2025
@SigureMo SigureMo merged commit 722701e into PaddlePaddle:develop Nov 5, 2025
93 of 97 checks passed
@SigureMo SigureMo deleted the fix_EagerParamBase_not_2_pirValue branch November 5, 2025 03:05
Manfredss pushed a commit to Manfredss/PaddleDebug that referenced this pull request Nov 7, 2025
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.

6 participants