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]Support Python3 type hint #33745

Merged
merged 2 commits into from
Jun 24, 2021

Conversation

Aurelius84
Copy link
Contributor

@Aurelius84 Aurelius84 commented Jun 23, 2021

PR types

Others

PR changes

Others

Describe

Support Python3 type hint

Example:

class LinearNetWithTuple2(BaseLayer):
    def __init__(self, in_size, out_size):
        super(LinearNetWithTuple2, self).__init__(in_size, out_size)

    def forward(self, x) -> Tuple[paddle.Tensor, np.array]:
        out1, out2 = self.build(x)
        return (out2, np.ones([4, 16]))


class LinearNetWithDict(BaseLayer):
    def __init__(self, in_size, out_size):
        super(LinearNetWithDict, self).__init__(in_size, out_size)

    def forward(self, x) -> Dict[str, paddle.Tensor]:
        out1, out2 = self.build(x)
        return {'out': out2}

@paddle-bot-old
Copy link

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

@@ -65,7 +65,7 @@ def set_test_func(self):
self.func = simple_func

def set_static_lineno(self):
self.static_abs_lineno_list = [3, 4, 5]
self.static_abs_lineno_list = [5, 6, 7]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we add two import statement, so here we adjust line infos by +2

Copy link
Member

@zhhsplendid zhhsplendid 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 c779780 into PaddlePaddle:develop Jun 24, 2021
Aurelius84 added a commit to Aurelius84/Paddle that referenced this pull request Jul 1, 2021
lanxianghit pushed a commit that referenced this pull request Jul 2, 2021
[Dy2Stat] Support Python3 type hint (#33745)
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