Yes. The forward pass will create the computation graph, which will be used for backpropagation to compute the gradients for all parameters which require gradients.
If you don’t use any such parameters, .backward() will raise an error.