What is the difference between b and e?

In the autograd doc https://pytorch.org/docs/stable/autograd.html#torch.Tensor.is_leaf, 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?


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()).