To make a transformed distribution I want to implement an inverse softplus function log(exp(x)-1).
To do this i would need to implement something like this
if x > 20:
return x
else:
return (x.exp() - 1).log()
torch.nn.functional.threshold would be promising, except it doesn’t support tensors in its value argument.
torch.where looks good too, but I would prefer to have a 0.3 compatible solution.
The cond * (...) + (1-cond) * (...) hack used in the below thread doesn’t work here since the (...)'s may be infinite.