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

[Cherry-pick][Dy2stat]Remove all comments of users code when dy2stat #38039

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

0x45f
Copy link
Contributor

@0x45f 0x45f commented Dec 10, 2021

PR types

Bug fixes

PR changes

Others

Describe

动转静时,将函数中的注释行进行删除。
之前对下面的代码进行动转静转写时因为有函数体外的注释行,使用gast库进行func2ast转换时会导致出错,本PR之后将注释行(#开头的行)进行了删除,下面代码动转静不会出错。

    def forward(self, x):
        x = self.conv1(x)
        x = F.relu(x)
        x = self.max_pool1(x)
        x = self.max_pool2(x)
        # import pdb; pdb.set_trace()
        #x = paddle.flatten(x, start_axis=1,stop_axis=-1)
#         x = paddle.flatten(x, start_axis=1,stop_axis=-1)
        x = self.flatten(x)
        # x = self.linear1(x)
        return x

…#38003)

* remove outer comment when dy2stat

* remove all comment

* add unit test
@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

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

@lanxianghit lanxianghit merged commit 01e2679 into PaddlePaddle:release/2.2 Dec 13, 2021
@0x45f 0x45f deleted the pick_dy2stat_comment branch December 24, 2021 04:49
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