Skip to content

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

Merged
Aurelius84 merged 3 commits into
PaddlePaddle:developfrom
0x45f:dy2stat_comment
Dec 10, 2021
Merged

[Dy2stat]Remove all comments of users code when dy2stat#38003
Aurelius84 merged 3 commits into
PaddlePaddle:developfrom
0x45f:dy2stat_comment

Conversation

@0x45f

@0x45f 0x45f commented Dec 9, 2021

Copy link
Copy Markdown
Contributor

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

paddle-bot-old Bot commented Dec 9, 2021

Copy link
Copy Markdown

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

@Aurelius84 Aurelius84 left a comment

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.

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