not_to_static¶
- paddle.jit. not_to_static ( func=None ) [source]
-
A Decorator to suppresses the convertion of a function.
- Parameters
-
func (callable) – The function to decorate.
- Returns
-
A function which won’t be converted in Dynamic-to-Static.
- Return type
-
callable
Examples
import paddle @paddle.jit.not_to_static def func_not_to_static(x): res = x - 1 return res @paddle.jit.to_static def func(x): if paddle.mean(x) < 0: out = func_not_to_static(x) else: out = x + 1 return out x = paddle.ones([1, 2], dtype='float32') out = func(x) print(out) # [[2. 2.]]