Converts imperative dygraph APIs into declarative function APIs. Decorator
Converts imperative dygraph APIs into declarative function APIs. Decorator
...
@@ -228,7 +243,6 @@ def to_static(
...
@@ -228,7 +243,6 @@ def to_static(
Tensor(s) to do imperative training, inference, or other operations. If the
Tensor(s) to do imperative training, inference, or other operations. If the
decorated function calls other imperative function, the called one will be
decorated function calls other imperative function, the called one will be
converted into declarative function as well.
converted into declarative function as well.
Args:
Args:
function (callable): callable imperative function.
function (callable): callable imperative function.
input_spec(list[InputSpec]|tuple[InputSpec]): list/tuple of InputSpec to specific the shape/dtype/name
input_spec(list[InputSpec]|tuple[InputSpec]): list/tuple of InputSpec to specific the shape/dtype/name
...
@@ -238,7 +252,8 @@ def to_static(
...
@@ -238,7 +252,8 @@ def to_static(
in the computational graph and memory optimization during the execution
in the computational graph and memory optimization during the execution
of the computational graph. For more information about build_strategy,
of the computational graph. For more information about build_strategy,
please refer to :code:`paddle.static.BuildStrategy`. The default is None.
please refer to :code:`paddle.static.BuildStrategy`. The default is None.
property(bool, Optional): whether the fucntion is python property. The default is False.
backend(str, Optional): Specifies compilation backend, which can be `CINN` or None. When backend is `CINN`, CINN compiler will be used to speed up training and inference.
kwargs: Support keys including `property`, set `property` to True if the fucntion is python property.