Skip to content

Commit 4d1526a

Browse files
committed
do not fail if no transform is used
1 parent 939c453 commit 4d1526a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bayesflow/approximators/continuous_approximator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,11 @@ def log_prob(self, data: Mapping[str, np.ndarray], **kwargs) -> np.ndarray | dic
399399
log_prob = self._log_prob(**data, **kwargs)
400400
log_prob = keras.tree.map_structure(keras.ops.convert_to_numpy, log_prob)
401401

402-
return log_prob + jacobian["inference_variables"]
402+
jacobian = jacobian.get("inference_variables")
403+
if jacobian is not None:
404+
log_prob = log_prob + jacobian
405+
406+
return log_prob
403407

404408
def _log_prob(
405409
self,

0 commit comments

Comments
 (0)