I have a tensor with dimensions (30, 35, 49). I want to reshape it to (30, 35, 512) in order to be able to multiply with another tensor which has also
(30, 35, 49)
(30, 35, 512)
import torch.nn.functional as F data = torch.ones(4, 4) # pad(left, right, top, bottom) new_data = F.pad(input=data, pad=(1, 1, 1, 1), mode='constant', value=0) print(new_data)