Revision 3e8bf1822003feaee9f4ca9e46cc06e4a81d041e authored by Vincent Dutordoir on 25 February 2020, 17:39:09 UTC, committed by GitHub on 25 February 2020, 17:39:09 UTC
This PR (superseding #1271) enables auto-generation of all of GPflow's documentation. Upon a new merge in `develop`, we trigger our new repo [GPflow/docs](https://github.com/GPflow/docs) to: - copy the complete content of GPflow/doc - compile the notebooks `.ipynb` from the `.pct.py` files - create the `rst` files for the api documentation required for readthedocs. #### TODO: - [ ] Allow for documentation at different tags of the source code.
1 parent 167973b
bijectors.py
from typing import Optional
import tensorflow_probability as tfp
from .. import config
from .utilities import to_default_float
__all__ = ["positive", "triangular"]
def positive(lower: Optional[float] = None, base: Optional[str] = None) -> tfp.bijectors.Bijector:
"""
Returns a positive bijector (a reversible transformation from real to positive numbers).
:param lower: lower bound override (defaults to config.default_positive_minimum())
:param base: overrides base positive bijector (defaults to config.default_positive_bijector())
:returns: a bijector instance
"""
if isinstance(base, str):
base = base.lower()
bijector = base if base is not None else config.default_positive_bijector()
bijector = config.positive_bijector_type_map()[bijector]()
if lower is None:
lower = config.default_positive_minimum()
if lower is not None:
# Chain applies transformations in reverse order, so shift will be applied last
shift = tfp.bijectors.Shift(to_default_float(lower))
bijector = tfp.bijectors.Chain([shift, bijector])
return bijector
def triangular() -> tfp.bijectors.Bijector:
"""
Returns instance of a triangular bijector.
"""
return tfp.bijectors.FillTriangular()
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...