What is torch.nn really? -- PyTorch Tutorials 1.0.0.dev20190117 documentation
Let's first create a model using nothing but PyTorch tensor operations. PyTorch provides methods to create random or zero-filled tensors, which we will use to create our weights and bias for a simple linear model. These are just regular tensors, with one very special addition: we tell PyTorch that they require a gradient. This causes PyTorch to record all of the operations done on the tensor, so that it can calculate the gradient during back-propagation automatically! For the weights, we set requires_grad after the initialization, since we don't want that step included in the gradient.
Jan-21-2019, 12:41:05 GMT
- Technology: