Pytensor nan_to_num

hi,
I was dealing with a problem of certain deterministic variables going to inf

r = \frac{1}{x}

is there a way to do something similar to numpy np.nan_to_num with pytensor ?

You can use pytensor.tensor.where to obtain the same behavior. Would be good to add a helper for that in PyTensor

1 Like