Bounded variable transformation when not using HMC?

Yeah we can’t abort of the sum early like that exactly because of undefined values like inf - inf or inf + nan, which must return nan.

Also accommodating these special cases would probably generate slower machine code due to the introduction of branching. This would be undesirable, because we expect the special branching to not be needed in the majority of cases.

If you really wanted, PyTensor has a lazy IfElse that could be used to that effect, but the switch would still be probably faster.

1 Like