Sampling rate becomes very slow after adding a line

I want sample longitude_i1 in the range of (0,80),but sometime it will show a error"index out of bounds". After some digging, Possible Bug in DiscreteUniform? - #2 by junpenglao may be the explanation.
so I add a line ‘lon_index1=tt.lt(lon_index1,80)’,the “index out of bounds” error disappears, but the sample speed becomes very slow, from 500draws/s to 5 draws/s.
also ,there is a warning

D:\Program\anaconda\lib\site-packages\theano\tensor\subtensor.py:2197: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  rval = inputs[0].__getitem__(inputs[1:])
with basic_model_nor:
   longitude_i1= pm.DiscreteUniform("longitude_i1", lower=0, upper=80) 
    lon_index1=tt.lt(lon_index1,80)

This line is not clipping your values if that’s what you wanted. You can try tt.clip(index, 0, 80).

1 Like

thanks for your help.
problem solved.