Solved by driazati in post #2 
              
              
                This is a known bug https://github.com/pytorch/pytorch/issues/26752 
You can workaround by implementing it yourself, but it can be cumbersome due to the reasons explained in the bug report (plus the fact that TorchScript does not support generic functions or recursion): 
def my_1d_tolist(x):
    res…