I have input tensor :

```
x=torch.tensor( [ [5,3,4,2,1,4,0,0],
[2,3,4,2,1,0,0,0],
[8,3,4,0,0,0,0,0],
[1,3,4,2,3,1,2,0] ] )
```

Instead of zero , there can be any value. I want to **ignore** those indices.

I want to do `torch.fft.fft( x, dim = -1 ) `

.

How can I apply a mask so It calculates before zero values or ignore those values/indices ? Should I use zeros or any other value or other solution ?

TORCH.FFT.FFT has a parameter n ( Signal length) but it trims for the whole dimension so it doesnâ€™t work for me unless I do it row by row with zero padding.