I am trying to make a concatenation operation using this line of code:

‘’’

mixture = torch.cat([mixture, torch.zeros(1, 1, padded_length, device=device2)], dim=-1)

‘’’’

Actually, it works well with PyTorch version 1.4.0 but in PyTorch version 1.7.1 it complains can anyone explain Why?

Could you describe the issue a bit more, please, and explain what the issue is exactly? Also, an executable code snippet to reproduce the issue in the latest release (assuming you are also seeing it in `1.9.0`

) would be helpful.

PS: I would not recommend to tag specific users, as it could discourage others to take a look at your question.

@ptrblck Sorry for specific tagging I will not do this again. I solved this problem.

I have another question I have a tensor of shape [1, 1, 64000] where the first 1 is the batch size can I make it of shape [1, 64000] i.e remove the first dim.

Yes, you can remove dimensions with a size of `1`

by using `tensor = tensor.squeeze(dim)`

, where `dim=0`

in your case.

So to if the tensor (x) shape for example [2, 1, 64000] and want to reshape it to anothe tensor (y) of shape [1, 64000] I will use

y = x.squeeze(dim=0)

No, squeezing a dimension with `size>1`

won’t work, since you would need to reduce the number of elements and could index the tensor instead e.g. via `y = x[0]`

.