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

【Hackathon No.89】 Remove circle import Part2 #51199

Merged
merged 14 commits into from
Mar 13, 2023

Conversation

Liyulingyue
Copy link
Contributor

@Liyulingyue Liyulingyue commented Mar 4, 2023

PR types

Others

PR changes

Others

Describe

Details

  • 根据核心框架开源贡献赛道——其他 #50711 将jit下的import移动到文件头部
  • python\paddle\jit\dy2static\call_transformer.py
    • from paddle.jit.dy2static.convert_call_func import is_builtin 直接移动到文件头
  • python\paddle\jit\dy2static\convert_call_func.py
    • import six:PASS
    • from paddle.nn import Sequential:未处理
    • from paddle.jit.dy2static.program_translator import (
      StaticFunction,
      convert_to_static,
      unwrap_decorators,
      ):移动CONVERSION_OPTIONS的声明到program_translator,统一import program_translator
  • python\paddle\jit\dy2static\convert_operators.py
    • from paddle.fluid.dygraph.base import in_declarative_mode:暂不处理
    • from paddle.static.nn.control_flow import Assert:暂不处理
  • python\paddle\jit\dy2static\partial_program.py
    • from paddle.incubate.autograd.primapi import to_prim:暂不处理
    • from paddle.amp.auto_cast import _in_amp_guard, _in_pure_fp16_guard:暂不处理
  • python\paddle\jit\dy2static\program_translator.py
    • from paddle.static import InputSpec:暂不处理
    • from paddle.incubate.autograd.primapi import to_prim:暂不处理
    • from paddle.fluid.dygraph.base import switch_declarative_mode_guard:暂不处理
    • from paddle.jit.dy2static.program_translator import (
      ProgramTranslator,
      ):直接删除
  • python\paddle\jit\dy2static\utils.py
    • from paddle.jit.dy2static.return_transformer import (
      RETURN_NO_VALUE_MAGIC_NUM,
      ):将声明迁移到utils
    • import paddle # noqa: F401
    • import paddle.fluid as fluid # noqa: F401
    • import paddle.fluid.dygraph as dygraph # noqa: F401
    • import paddle.fluid.layers as layers # noqa: F401
    • import paddle.jit.dy2static as _jst # noqa: F401
    • from paddle import to_tensor # noqa: F401
    • from paddle.fluid.dygraph import to_variable # noqa: F401
    • import numpy as np # noqa: F401:上述均暂不修改
    • from .static_analysis import StaticAnalysisVisitor:暂不处理,在下个PR中解决
    • from paddle.jit.dy2static.static_analysis import NodeVarType:暂不处理,在下个PR中解决,这两个对static_analysis的引用可能都需要迁移logging和static中的实现,可能需要修改_init_.py
    • from paddle.jit.dy2static.ifelse_transformer import (
      FALSE_FUNC_PREFIX,
      TRUE_FUNC_PREFIX,
      ):将声明移动到utils
    • from paddle.jit.dy2static.loop_transformer import (
      FOR_BODY_PREFIX,
      FOR_CONDITION_PREFIX,
      WHILE_BODY_PREFIX,
      ): 将声明移动到utils

@paddle-bot
Copy link

paddle-bot bot commented Mar 4, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Mar 4, 2023
from typing import Any, List

import numpy

from paddle.fluid.dygraph.layers import Layer
from paddle.jit.dy2static.logging_utils import TranslatorLogger
from paddle.jit.dy2static.utils import is_paddle_func, unwrap
from paddle.jit.dy2static.utils import is_builtin, is_paddle_func, unwrap
Copy link
Contributor

Choose a reason for hiding this comment

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

后续 from paddle.jit.dy2static.xxx 可以考虑优化为 from .xxx 么?

@@ -44,7 +44,6 @@
# should return.

# Assign not support float64, use float32 value as magic number.
RETURN_NO_VALUE_MAGIC_NUM = 1.77113e27
RETURN_NO_VALUE_VAR_NAME = "__no_value_return_var"
Copy link
Contributor

Choose a reason for hiding this comment

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

RETURN_NO_VALUE_VAR_NAME 是否也可以考虑到utils.py里,与RETURN_NO_VALUE_MAGIC_NUM这个magic number放一起?

FALSE_FUNC_PREFIX = 'false_fn'

WHILE_BODY_PREFIX = 'while_body'
FOR_CONDITION_PREFIX = 'for_loop_condition'
Copy link
Contributor

Choose a reason for hiding this comment

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

可否将这些全局的config字段统一放到文件import 语句后面?

@Liyulingyue
Copy link
Contributor Author

Liyulingyue commented Mar 9, 2023

@Aurelius84 根据上述的建议修改了本PR涉及的内容。codestyle那块没法过去,因为对应的包是通过执行字符串的形式使用的,所以必须保留引用~

Co-authored-by: Aurelius84 <zhangliujie@baidu.com>
Aurelius84
Aurelius84 previously approved these changes Mar 9, 2023
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

@luotao1
Copy link
Contributor

luotao1 commented Mar 10, 2023

@Liyulingyue 请解决下冲突

@paddle-bot
Copy link

paddle-bot bot commented Mar 10, 2023

很抱歉,经过我们的反复讨论,你的PR暂未达到合入标准,请阅读飞桨原生算子开发规范,你可以重新提交新的PR,我们先将此PR关闭,感谢你的贡献。
Sorry to inform you that through our discussion, your PR fails to meet the merging standard (Reference: Paddle Custom Operator Design Doc). You can also submit an new one. Thank you.

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 34358de into PaddlePaddle:develop Mar 13, 2023
@Liyulingyue Liyulingyue deleted the circle_import_2 branch March 23, 2023 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants