fix(messages): fix TransformedMessage.factor_gradient unpack and chain-rule logd_jacs accumulation - #1502
Conversation
…n-rule logd_jacs accumulation
…al to numerical gradient
|
Agreed! I verified the gradient accumulation directly against numerical finite differences across both scalar and multivariate transform compositions in |
|
Hi @trexfr-ops — thanks for this PR, and for including a finite-difference test alongside the fix. Apologies for the long silence on our side. CI has now been approved to run on the branch (first-contributor workflow runs were sitting pending): https://github.com/PyAutoLabs/PyAutoFit/actions/runs/32269399401 One bit of context on why this is on hold rather than being reviewed straight away: whether |
Description
Closes #1501
This PR resolves the crash in
TransformedMessage.factor_gradientwhere it unpacked 4 values fromself._transform_det_jac(x)(which returns 3:(x, logd, logd_jacs)).Changes
factor_gradientinautofit/messages/composed_transform.pyto unpackx, logd, logd_jacs = self._transform_det_jac(x).logd_gradin reverse order:test_autofit/graphical/functionality/test_messages.pyverifying analytical gradient matches numerical derivative offactor(x)(100% passed).💰 Bounty Claim & LTC Payout Address:
LPnftYop8yhRNQZstysT3vuJf3XkpQWKTC