!7661 add ckpt code example

Merge pull request !7661 from changzherui/add_ckpt_example
This commit is contained in:
mindspore-ci-bot 2020-10-26 09:49:52 +08:00 committed by Gitee
commit 2d6c07a367
1 changed files with 5 additions and 0 deletions

View File

@ -341,6 +341,11 @@ def load_param_into_net(net, parameter_dict, strict_load=False):
Raises:
TypeError: Argument is not a Cell, or parameter_dict is not a Parameter dictionary.
Examples:
>>> net = LeNet5()
>>> param_dict = load_checkpoint("LeNet5-2_1875.ckpt")
>>> load_param_into_net(net, param_dict)
"""
if not isinstance(net, nn.Cell):
logger.error("Failed to combine the net and the parameters.")