Yes, that’s what I mean. Your explanation of how autograd works isn’t quite right.
Here’s some more detail into how autograd does that. The repeat function is implemented here 21 and it has a forward() and backward() function. Autograd will call the backward function when computing gradients: repeat’s backward takes into account how the forward pass repeated the data.