Just found I randomly coded some_data.unsqueeze(0).to(device) and some_data.to(device).unsqueeze(0). If I recall correctly, torch.Tensor.to involves data transferring, something like cudaMemcpyHostToDevice?. Which makes me wonder, suppose device is set to GPU, does different order between .to(device) and tensor operation yield different performance, etc? Continue reading...