No gradients available for affine transforms

I was looking for some information on affine transforms and came across post on a thread: Affine transformation matrix paramters conversion

When I try to print(x_trans.grad_fn) at the end, it prints None. Can someone help me understand why no gradients are calculated for this operation?

If no parameters in the operations require a gradient, you won’t get a grad_fn.
You could set requires_grad=True e.g. for x, which will give you a valid grad_fn in x_trans.