RuntimeError when changing the values of specific parts of a `torch.Tensor`
Say I have a 3 dimentional tensor x initialized with zeros:

x = torch.zeros((2, 2, 2))


and an other 3 dimentional tensor y

y = torch.ones((2, 1, 2))


I am trying to change the values of the first line of x[0] and x[1] like this

x[:, 0, :] = y


but I get this error:

RuntimeError: expand(torch.FloatTensor{[2, 1, 2]}, size=[2, 2]): the number of sizes provided (2) must be greater or equal to the number of dimensions in the tensor (3)


It is as if the tensor y was getting squeezed somehow.  Is there a way around this?

I found a straight forward way to do it:

x[:, 0, :] = y[:, 0, :]

