How can reshape 2d tensor to 1d
tensor([[0, 5],
        [1, 4],
        [2, 2],
        [4, 2],
        [7, 9],
        [2, 0]) 

I want to reshape this tensor to
tensor([[5],
        [14],
        [22],
        [42],
        [79],
        [20])

how can i solve this problem? please help me

I don't know about tensor data type, but for normal list you can iterate over each inner list and convert them to digit
def toDigit(l):
    z = 1
    s = 0
    for v in l[::-1]:
        s += v * z
        z *= 10
    return s


a = [[0, 5],[1, 4],[2, 2],[4, 2],[7, 9],[2, 0], [0,0]]
print([toDigit(t) for t in a])

The output will be:
[5, 14, 22, 42, 79, 20, 0]

