@@ -331,10 +331,7 @@ Please refer to contents in [PaddleBook](https://github.com/PaddlePaddle/book/tr
dy_out = avg_loss.numpy()
if epoch == 0 and batch_id == 0:
for param in mnist.parameters():
dy_param_init_value[param.name] = param.numpy()
avg_loss.backward()
sgd.minimize(avg_loss)
mnist.clear_gradients()
...
...
@@ -388,11 +385,11 @@ Please refer to contents in [PaddleBook](https://github.com/PaddlePaddle/book/tr
In model traning, you can use ` fluid.dygraph.save_persistables(your_model_object.state_dict(), "save_dir")` to save all model parameters in `your_model_object`. And you can define Python Dictionary introduction of "parameter name" - "parameter object" that needs to be saved yourself.
Or use `your_modle_object.load_dict(
fluid.dygraph.load_persistables(your_model_object.state_dict(), "save_dir"))` interface to recover saved model parameters to continue training.
Or use `your_modle_object.load_dict(fluid.dygraph.load_persistables("save_dir"))` interface to recover saved model parameters to continue training.
The following codes show how to save parameters and read saved parameters to continue training in the "Handwriting Digit Recognition" task.
dy_param_init_value={}
for epoch in range(epoch_num):
for batch_id, data in enumerate(train_reader()):
dy_x_data = np.array(
...
...
@@ -419,8 +416,8 @@ The following codes show how to save parameters and read saved parameters to con