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

add control/status API #37885

Merged
merged 10 commits into from
Dec 23, 2021
Merged

add control/status API #37885

merged 10 commits into from
Dec 23, 2021

Conversation

Avin0323
Copy link
Contributor

@Avin0323 Avin0323 commented Dec 6, 2021

PR types

New features

PR changes

APIs

Describe

新增控制/状态类API:

  • paddle.is_floating_point;
  • paddle.Tensor.is_floating_point;
  • paddle.is_grad_enabled;

中文文档:

image

image

image

英文文档:

image

image

image

@paddle-bot-old
Copy link

paddle-bot-old bot commented Dec 6, 2021

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

@Avin0323 Avin0323 changed the title [WIP] add control/status API add control/status API Dec 10, 2021

def is_grad_enabled():
"""
Returns currently dygraph gradient calculation mode which is enabled.
Copy link
Member

Choose a reason for hiding this comment

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

English:
“Returns whether current dygraph gradient calculation mode is enabled”
Or "Returns whether dygraph gradient calculation mode is enabled currently"

  1. "Current" is adj. "Currently" is adv. So you could say "current mode" but not "currently mode".
  2. 用“Whether“表示是否。你上面的英语里which是修饰作用。所以你那句的英语意思是:”Return .... mode which is .... “, which修饰mode。你上面的英语意思是返回一个mode。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


import paddle

paddle.is_grad_enabled() # True
Copy link
Member

Choose a reason for hiding this comment

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

You could add comment "Dygraph gradient calculation mode is enabled by default."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -16,6 +16,7 @@
from .attribute import shape # noqa: F401
from .attribute import real # noqa: F401
from .attribute import imag # noqa: F401
from .attribute import is_floating_point # noqa: F401
Copy link
Member

Choose a reason for hiding this comment

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

I checked the code of is_floating_point, do we have to add API document for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

zhhsplendid
zhhsplendid previously approved these changes Dec 21, 2021
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

@Avin0323 Avin0323 closed this Dec 21, 2021
@Avin0323 Avin0323 reopened this Dec 21, 2021
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

Copy link
Contributor

@jzhang533 jzhang533 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LG API

@Avin0323 Avin0323 merged commit 21b7ed3 into PaddlePaddle:develop Dec 23, 2021
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.

4 participants