Would you print a shape of data by print(data.shape)?
If it has 3-dimensions including batch then data = data.transpose(2, 1)
if len(data.shape) == 3:
    # (A, B, C) --> (A, C, B)
    data = data.transpose(2, 1)
elif len(data.shape) == 2:
    # (A, B) --> (B, A)
    data = data.transpose(1, 0)
else:
    pass