Skip to content

Instantly share code, notes, and snippets.

@shunting314
Created December 24, 2025 22:55
Show Gist options
  • Select an option

  • Save shunting314/231c6eec77d40b2b6246542f7627ef73 to your computer and use it in GitHub Desktop.

Select an option

Save shunting314/231c6eec77d40b2b6246542f7627ef73 to your computer and use it in GitHub Desktop.
import torch
torch.set_default_device("cuda")
x = torch.randn(5)
t = torch.arange(2)
x[t] = 3
x[2] = 8
t2 = torch.arange(8)
x[t2] = 9
x[3] = 9
x[1] = 5
torch.cuda.synchronize()
print("bye")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment