It’s a few more lines in PyTorch, but this will work if your input is C-style contiguous:
t = torch.randn(3, 5)
t = t.t().contiguous().t()
print(t.shape)  # torch.Size([3, 5])
print(t.stride())  # (1, 3)