libtorch torch::save

In pytorch when train model over we can save model . such as{
‘epoch’: epoch,
‘model_state_dict’: model.state_dict(),
‘optimizer_state_dict’: optimizer.state_dict(),
‘loss’: loss,

}, PATH)

and load model and param such as
epoch = checkpoint[‘epoch’]
loss = checkpoint[‘loss’]

but in libtorch . I don’t know how to achieve it . Please help me?

You could save the objects directly via torch::save as seen here.