Hello

I’m trying to find the equivalent pytorch (or C++) for scipy.signal.argrelmax(), which finds the peaks in a 1D array with some padding. https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.argrelmax.html

Here’s what I’ve come up with and it is faster than scipy.signal.argrelmax (especially for longer arrays) - but I’m missing a fast solution to the last step which deletes peaks within some window.

```
import torch
# initalize an array array
gpu_max = torch.rand(100000)
# find peaks and troughs by subtracting shifted versions
gpu_temp1 = gpu_max[1:-1]-gpu_max[:-2]
gpu_temp2 = gpu_max[1:-1]-gpu_max[2:]
# and checking where both shifts are positive;
out1 = torch.where(gpu_temp1>0, gpu_temp1*0+1, gpu_temp1*0)
out2 = torch.where(gpu_temp2>0, out1, gpu_temp2*0)
# argrelmax containing all peaks
argrelmax_gpu = torch.nonzero(out2, out=None)+1
```

I posted this on stackoverflow and there’s a picture there that visualize the issue: https://stackoverflow.com/questions/54498775/pytorch-argrelmax-function-or-c.

Any input much appreciated!