| 1614 | } |
| 1615 | |
| 1616 | Tensor Mult(const Tensor &A, const Tensor &B) { |
| 1617 | auto A_ = Broadcast(A, B.shape(), 2); |
| 1618 | auto B_ = Broadcast(B, A.shape(), 2); |
| 1619 | |
| 1620 | Shape s = A_.shape(); |
| 1621 | s.pop_back(); |
| 1622 | s.push_back(B.shape(B.nDim() - 1)); |
| 1623 | |
| 1624 | Tensor out(s, A.device(), A.data_type()); |
| 1625 | Mult(A_, B_, &out); |
| 1626 | return out; |
| 1627 | } |
| 1628 | |
| 1629 | void Mult(const Tensor &A, const Tensor &B, Tensor *out) { |
| 1630 | Mult(1.0f, A, B, 0.0f, out); |