Browse Source

add ckpt code example

tags/v1.1.0
changzherui 5 years ago
parent
commit
d6902ca5ae
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      mindspore/train/serialization.py

+ 5
- 0
mindspore/train/serialization.py View File

@@ -341,6 +341,11 @@ def load_param_into_net(net, parameter_dict, strict_load=False):


Raises: Raises:
TypeError: Argument is not a Cell, or parameter_dict is not a Parameter dictionary. 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): if not isinstance(net, nn.Cell):
logger.error("Failed to combine the net and the parameters.") logger.error("Failed to combine the net and the parameters.")


Loading…
Cancel
Save