Premium problem43. Flatten a Tensor

Easy Locked

Flatten the tensor X into a 1-D tensor containing all of its elements in row-major order.

Input

tensor([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])

Output

tensor([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11])

Premium problem

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

Implement solve(...)