PyTorch 启程&拾遗

1、、Tensors are similar to NumPy’s ndarrays, with the addition being that Tensors can also be used on a GPU to accelerate computing.

2、、Any operation that mutates a tensor in-place is post-fixed with an ``_``.

# For example: ``x.copy_(y)``, ``x.t_()``, will change ``x``.

3、、You need to clear the existing gradients though, else gradients will be accumulated to existing gradients.

# # zeroes the gradient buffers of all parameters

4、、

print(loss.grad_fn.next_functions[0][0].next_functions[0][0])

5、、