You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
torch.randn() used here first allocates space for self.batch_size in the host memory and then copies it to the device memory, wasting host-device bandwidth.
As self.batch_size contains random values, we can directly create self.batch_size on the device to bypass this non-sense host-device data copy. The proposed patch is as follows.
torch.randn() used here first allocates space for self.batch_size in the host memory and then copies it to the device memory, wasting host-device bandwidth.
As self.batch_size contains random values, we can directly create self.batch_size on the device to bypass this non-sense host-device data copy. The proposed patch is as follows.
-torch.randn((self.batch_size, 3, 224, 224)).to(self.device)
+torch.randn((self.batch_size, 3, 224, 224), device=self.device)
The text was updated successfully, but these errors were encountered: