import torch
if __name__ == '__main__':
a = torch.FloatTensor([1,2,3])
b = torch.FloatTensor([4,5,6])
x = torch.unsqueeze(a,dim=1)
y = torch.unsqueeze(b,dim=0)
print(x)
print(y)
print(x*y)
output:
tensor([[1.],
[2.],
[3.]])
tensor([[4., 5., 6.]])
tensor([[ 4., 5., 6.],
[ 8., 10., 12.],
[12., 15., 18.]])