The following code works fine in regular Pytorch
def pad_audio(self,tensor,n_max=50000):
    
    diff_pad = n_max - len(tensor)    
    
    tensor = F.pad(tensor,(int(diff_pad/2),diff_pad - int(diff_pad/2)),'constant',0)

But when using JIT script, I get the following error:

_pad(Tensor input, int[] pad, str mode="constant", float value=0.) -> (Tensor):
Expected a value of type 'List[int]' for argument 'pad' but instead found type 'Tuple[int, Tensor]'.
:
        diff_pad = n_max - len(tensor)    
        
        tensor = F.pad(tensor,(int(diff_pad/2),diff_pad - int(diff_pad/2)),'constant',0)
                 ~~~~~ <--- HERE

What is the correct way of using pad in TorchScript?