tyxe/guides.py
def init_to_constant(site, c):
    """Helper function to set site value to a constant value."""
    site_fn = site["fn"]
    value = torch.full_like(site_fn.sample(), c)
    if hasattr(site_fn, "_validate_sample"):
        site_fn._validate_sample(value)
    return value
Helper function to set site value to a constant value.
Helper function to set site value to a constant value.
Helper function to set site value to a constant value .
def init_to_constant(site, c):
    site_fn = site["fn"]
    value = torch.full_like(site_fn.sample(), c)
    if hasattr(site_fn, "_validate_sample"):
        site_fn._validate_sample(value)
    return value
def init_to_constant ( site , c ) : site_fn = site [ "fn" ] value = torch . full_like ( site_fn . sample ( ) , c ) if hasattr ( site_fn , "_validate_sample" ) : site_fn . _validate_sample ( value ) return value
Helper function to set site value to a constant value.
Helper function to set site value to a constant value .
"""Helper function to set site value to a constant value."""
site
c