Skip to content

Commit

Permalink
Allow gpflow.utilities.triangular() to return FillScaleTriL
Browse files Browse the repository at this point in the history
  • Loading branch information
st-- committed Nov 12, 2020
1 parent 282d1cd commit cf7dc6d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gpflow/utilities/bijectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ def positive(lower: Optional[float] = None, base: Optional[str] = None) -> tfp.b
return bijector


def triangular() -> tfp.bijectors.Bijector:
def triangular(positive_diag: bool = False, diag_bijector=None) -> tfp.bijectors.Bijector:
"""
Returns instance of a triangular bijector.
:param positive_diag: if True, constrains the diagonal to be positive
:param diag_bijector: passed through to FillScaleTriL for positive_diag
"""
return tfp.bijectors.FillTriangular()
if positive_diag:
return tfp.bijectors.FillScaleTriL(diag_bijector=diag_bijector)
else:
assert diag_bijector is None, "should not pass diag_bijector when positive_diag is False"
return tfp.bijectors.FillTriangular()

0 comments on commit cf7dc6d

Please sign in to comment.