未验证 提交 f35de273 编写于 作者: J JYChen 提交者: GitHub

add deprecated decorator for paddle.utils.profiler (#50133)

上级 e62b0c2c
...@@ -19,6 +19,7 @@ from ..fluid import core ...@@ -19,6 +19,7 @@ from ..fluid import core
from ..fluid.profiler import cuda_profiler # noqa: F401 from ..fluid.profiler import cuda_profiler # noqa: F401
from ..fluid.profiler import profiler # noqa: F401 from ..fluid.profiler import profiler # noqa: F401
from ..fluid.profiler import reset_profiler, start_profiler, stop_profiler from ..fluid.profiler import reset_profiler, start_profiler, stop_profiler
from .deprecated import deprecated
__all__ = [ # noqa __all__ = [ # noqa
'Profiler', 'Profiler',
...@@ -32,6 +33,12 @@ __all__ = [ # noqa ...@@ -32,6 +33,12 @@ __all__ = [ # noqa
] ]
@deprecated(
since="2.4.2",
update_to="paddle.profiler.Profiler",
level=1,
reason="Please use new profiler tool, this profiler tool is no longer maintained.",
)
class ProfilerOptions: class ProfilerOptions:
def __init__(self, options=None): def __init__(self, options=None):
self.options = { self.options = {
...@@ -72,6 +79,12 @@ class ProfilerOptions: ...@@ -72,6 +79,12 @@ class ProfilerOptions:
_current_profiler = None _current_profiler = None
@deprecated(
since="2.4.2",
update_to="paddle.profiler.Profiler",
level=1,
reason="Please use new profiler tool, this profiler tool is no longer maintained.",
)
class Profiler: class Profiler:
def __init__(self, enabled=True, options=None): def __init__(self, enabled=True, options=None):
if options is not None: if options is not None:
...@@ -146,6 +159,12 @@ class Profiler: ...@@ -146,6 +159,12 @@ class Profiler:
self.stop() self.stop()
@deprecated(
since="2.4.2",
update_to="paddle.profiler.Profiler",
level=1,
reason="Please use new profiler tool, this profiler tool is no longer maintained.",
)
def get_profiler(): def get_profiler():
global _current_profiler global _current_profiler
if _current_profiler is None: if _current_profiler is None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册