File I/O

https://d2l.ai/chapter_builders-guide/read-write.html

Exercises and my silly answers

  1. Even if there is no need to deploy trained models to a different device, what are the practical
    benefits of storing model parameters?
  • we can create checkpoints within the code and go back if required.
  1. Assume that we want to reuse only parts of a network to be incorporated into a network
    of a different architecture. How would you go about using, say the first two layers from a
    previous network in a new network?
  • this works net[0].weight = nn.Parameter(clone.state_dict()['linear1.weight'])
    net[1] = another_net[1]
  1. How would you go about saving the network architecture and parameters? What restrictions
    would you impose on the architecture
  • this works torch.save(net, 'net') and then load it into a new network.

My solutions to the exs: 6.6