Premium problem34. Outer Product with einsum

Medium Locked

Return the outer product of vectors A (length m) and B (length n): an (m, n) matrix where entry (i, j) equals A[i] * B[j]. Use einsum notation rather than broadcasting it out by hand.

Input

A = tensor([1., 2., 3.])
B = tensor([4., 5.])

Output

tensor([[ 4.,  5.],
        [ 8., 10.],
        [12., 15.]])

Premium problem

This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.

Implement solve(...)