Is this way of using asynchronous copy invalid? If so, why didn’t it raise an error?

import gc
import torch

a = torch.empty(102410241024)
b = torch.ones(102410241024, device=‘cuda’)
a.copy_(b, non_blocking=True)

del a # Python will release the memory of a. Could this cause an exception in copy_ here?

gc.collect()