Skip to content
Discussion options

You must be logged in to vote

I think unused computation can trivially be optimized by JIT.
But I think there is some workaround as well:

@register_pytree_node_class
@dataclass(repr=True)
class CovParams:

    scale_tril:jnp.ndarray
    cov:jnp.ndarray
    prec:jnp.ndarray


    def __init__(self, scale_tril=None, cov=None):

        if cov is not None:
            self.cov = cov
            self.scale_tril = jnp.linalg.cholesky(self.cov)

        elif scale_tril is not None:
            self.scale_tril = scale_tril
        else:
            raise ValueError(
                "One of `covariance_matrix`, `scale_tril`"
                " must be specified."
            )

    @lazy_property
    def cov(self):
        return

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@mchagneux
Comment options

@YouJiacheng
Comment options

@mchagneux
Comment options

@YouJiacheng
Comment options

@mchagneux
Comment options

Answer selected by mchagneux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants