We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← All tracks
0 / 4
Memory, Copies and In-Place
PyTorchClone, detach, `copy_`, `out=`, preallocation. When an in-place op is the right answer, when it is a correctness bug, and how to tell which situation you are in from the code alone.
0
/ 6 solved
- 1. Not solved yet. Clone, detach, or both
- 2. Not solved yet. Write into the buffer you were given
- 3. Not solved yet. Fill the caller's buffer
- 4. Not solved yet. The history that rewrites itself
- 5. Not solved yet. Updating a parameter by hand
- 6. Not solved yet. Gradient accumulation, and the buffer that never moved
Check yourself
4 questions · one attempt eachThese do not count toward finishing the track. They are here to catch the things that are easy to read past.
How do clone() and detach() differ on a tensor that requires grad?
z = torch.ones(2, requires_grad=True)
z.detach()
z.clone()
Question 1 of 4