Suppose I have a PyTorch tensor t
of shape (3, 3, 3, 3)
, and I want to set t[0, 1, x, y]
to z
for all x
and y
. I noticed all the following syntaxes work:
t[0, 1] = z
t[0, 1, :] = z
t[0, 1, :, :] = z
t[0, 1, ...] = z
Is there any difference in terms of how things are executed under the hood? Is any one of these methods preferred over the others?