What is the difference between b and e?

In the autograd doc Automatic differentiation package - torch.autograd — PyTorch 2.1 documentation, I found the following examples:

I wonder what is the difference between b and e here? Why is e not a Tensor created by the operation that casts a cpu Tensor into a cuda Tensor, just like b?

Thanks!

The last operation on e is the inplace operation .requires_grad_(), which will create the leaf.
In b you are creating a leaf tensor first, but are applying another operation on it (.cuda()).