Performance, Pytorch, Deep Learning, Artificial Intelligence, Tensorboard.
common PyTorch ops, the size of the tensor that is returned by torch.nonzero is not pre-determined. The CPU does not know how many non-zero elements there are in the input tensor ahead of time. It needs to wait for the sync event from the GPU in order to perform the appropriate GPU memory