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

[Dy2stat]Remove all comments of users code when dy2stat #38003

Merged
merged 3 commits into from
Dec 10, 2021

Conversation

0x45f
Copy link
Contributor

@0x45f 0x45f commented Dec 9, 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

@paddle-bot-old
Copy link

paddle-bot-old bot commented Dec 9, 2021

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

@0x45f 0x45f changed the title [Dy2stat]Remove outer comment when dy2stat [Dy2stat]Remove all comments of users code when dy2stat Dec 10, 2021
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

@Aurelius84 Aurelius84 merged commit 515d356 into PaddlePaddle:develop Dec 10, 2021
0x45f added a commit to 0x45f/Paddle that referenced this pull request Dec 10, 2021
…#38003)

* remove outer comment when dy2stat

* remove all comment

* add unit test
lanxianghit pushed a commit that referenced this pull request Dec 13, 2021
)

动转静时,将函数中的注释行进行删除。
有函数体外的注释行,使用gast库进行func2ast转换时会导致出错,本PR之后将注释行(#开头的行)进行了删除
@0x45f 0x45f deleted the dy2stat_comment branch December 24, 2021 04:50
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.

2 participants