Is there a way to access the gradients directly from the loss, without using an optimizer?
For example,

inputs, labels = inputs.half().to(device=self.args.device, non_blocking=True), labels.to(device=self.args.device, non_blocking=True)
outputs = self.model(inputs)
minibatch_loss = self.criterion(outputs, labels)
minibatch_loss.backward()

Can I access the gradients from

minibatch_loss

somehow ?