Skip to content

Commit 5a8105c

Browse files
committed
polish warning message.
1 parent e2edcaf commit 5a8105c

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

python/paddle/fluid/dygraph/jit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ def fun(inputs):
760760

761761
if static_function._class_instance is None:
762762
warnings.warn(
763-
'Only when {} does not contain parameters, `jit.save` can succeed. If it contains parameters, please confirm that it is a member function of `paddle.nn.Layer` and these parameters are in `state_dict`, otherwise it cannot be saved with `jit.save`'.
763+
'`jit.save` will only save the `Program`, not the parameters. If you have to save the parameters, please make sure that {} is a member function of `paddle.nn.Layer` and the saved parameters are in `state_dict`'.
764764
format(layer))
765765

766766
dygraph_state_dict = None

python/paddle/fluid/tests/unittests/test_jit_save_load.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,10 +1312,8 @@ def anothor_forward(self, x):
13121312
inps = paddle.rand([3, 5])
13131313
origin = layer.anothor_forward(inps)
13141314

1315-
func = paddle.jit.to_static(
1316-
layer.anothor_forward, [paddle.static.InputSpec(shape=[-1, 5])])
13171315
path = 'test_jit_save_load_function_with_params_case3/func'
1318-
paddle.jit.save(func, path)
1316+
paddle.jit.save(layer.anothor_forward, path)
13191317
load_func = paddle.jit.load(path)
13201318

13211319
load_result = load_func(inps)

0 commit comments

Comments
 (0)