hello，

```
>>> b = torch.tensor([1,2,3])
>>> a = torch.tensor([1,2,3,4,5,6,7,8,9])
```

what should I do to make c = a* b = [1,4,9,4,10,18,7,16,27]??

Thanks!

hello，

```
>>> b = torch.tensor([1,2,3])
>>> a = torch.tensor([1,2,3,4,5,6,7,8,9])
```

what should I do to make c = a* b = [1,4,9,4,10,18,7,16,27]??

Thanks!

Maybe you should read tensor matrix operation first

```
c = (a.reshape(-1, b.shape[0])*b).flatten()
```

Thanks！I do it in this way

```
b.repeat(3).mul(a)
```

=-=

1 Like