Skip to content

Commit

Permalink
left KL trace term comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatrik96 committed Jun 28, 2023
1 parent 821b6e2 commit 476f69a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ima_vae/metrics/cima.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@

def cima_kl_diagonality(jacobian: torch.Tensor):
"""
Calculates the IMA constrast. Able to handle jax and Pytorch objects as well
Calculates the IMA constrast. Able to handle jax and Pytorch objects as well.
Source: https://www.sciencedirect.com/science/article/pii/S0024379516303834
Note that the trace term in Eq. (10) of the above paper cancels since the \hat{A} matrix in the paper
(which corresponds to A=jacobian_t_jacobian rescaled as diag(A)^{-1/2}@A@diag(A)^{-1/2})
is symmetric and positive definite with 1's on the main diagonal, so tr(\hat{A}-I)=0.
Thus, it is not included in the code
:param jacobian: jacobian matrix (jax or Pytorch)
:return:
Expand Down

0 comments on commit 476f69a

Please sign in to comment.