loss.backward() calculates all gradients in the current computation graph (including the filter weight gradients). The weights are updated if you call optimizer.step() (and passed these parameters to the optimizer before) or update the weights manually using the gradients.
@modeler in fact the weights change in every iteration if the gradients are non-zero.