title: How to include batch size in pytorch basic example?
body: <p>I am new to pytorch. The following is the basic example of using <strong>nn</strong> module to train a simple one-layer model with some random data (<a href="https://pytorch.org/tutorials/beginner/pytorch_with_examples.html" rel="noreferrer">from here</a>)</p>
  
  <pre><code>import torch
  N, D_in, H, D_out = 64, 1000, 100, 10
  
  x = torch.randn(N, D_in)
  y = torch.randn(N, D_out)
  
  model = torch.nn.Sequential(
      torch.nn.Linear(D_in, H),
      torch.nn.ReLU(),
      torch.nn.Linear(H, D_out),
  )
  loss_fn = torch.nn.MSELoss(reduction='sum')
  optimizer = torch.optim.Adam(model.parameters(), lr=1e-4)
  for t in range(500):
      y_pred = model(x)
  
      loss = loss_fn(y_pred, y)
      print(t, loss.item())
  
      optimizer.zero_grad()
      loss.backward()
      optimizer.step()
  </code></pre>
  
  <p>As far as I understand, the batch size is equal to 1 in the example, in other words, a single point (out of 64) is used to calculate gradients and update parameters. My question is: how to modify this example to train the model with the batch size greater than one? </p>