`distribution_fn(sample0).event_shape.num_elements()` are both `None`.
ValueError: if `num_steps < 1`.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name) as name:
self._distribution_fn = distribution_fn
self._sample0 = sample0
from tensorflow.python.ops import check_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops.distributions import distribution as distribution_lib
-from tensorflow.python.ops.distributions import util as distribution_util
__all__ = [
ValueError: if `batch_shape` size is not the same as a
`distribution.batch_shape` size.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
name = name or "BatchReshape" + distribution.name
with ops.name_scope(name, values=[batch_shape]) as name:
# The unexpanded batch shape may contain up to one dimension of -1.
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[total_count, logits, probs]) as name:
self._total_count = self._maybe_assert_valid_total_count(
ops.convert_to_tensor(total_count, name="total_count"),
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
-from tensorflow.python.ops.distributions import util as distribution_util
__all__ = [
"Cauchy",
Raises:
TypeError: if `loc` and `scale` have different `dtype`.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[loc, scale]) as name:
with ops.control_dependencies([check_ops.assert_positive(scale)]
if validate_args else []):
from tensorflow.python.ops import check_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops.distributions import gamma
-from tensorflow.python.ops.distributions import util as distribution_util
__all__ = [
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
# Even though all stats of chi2 are defined for valid parameters, this is
# not true in the parent class "gamma." therefore, passing
# allow_nan_stats=True
validate_args=False,
allow_nan_stats=True,
name="Chi2WithAbsDf"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[df]) as name:
super(Chi2WithAbsDf, self).__init__(
df=math_ops.floor(
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops.distributions import distribution
-from tensorflow.python.ops.distributions import util as distribution_util
__all__ = [
"Deterministic",
Raises:
ValueError: If `loc` is a scalar.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[loc, atol, rtol]) as name:
loc = ops.convert_to_tensor(loc, name="loc")
if is_vector and validate_args:
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[logits, probs]) as name:
self._logits, self._probs = distribution_util.get_logits_and_probs(
logits, probs, validate_args=validate_args, name=name)
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
-from tensorflow.python.ops.distributions import util as distribution_util
class _Gumbel(distribution.Distribution):
Raises:
TypeError: if loc and scale are different dtypes.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[loc, scale]) as name:
with ops.control_dependencies([check_ops.assert_positive(scale)] if
validate_args else []):
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import special_math
-from tensorflow.python.ops.distributions import util as distribution_util
__all__ = [
if one or more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[scale]) as name:
with ops.control_dependencies([check_ops.assert_positive(scale)] if
validate_args else []):
from tensorflow.python.ops import math_ops
from tensorflow.python.ops.distributions import distribution as distribution_lib
from tensorflow.python.ops.distributions import kullback_leibler
-from tensorflow.python.ops.distributions import util as distribution_util
class Independent(distribution_lib.Distribution):
ValueError: if `reinterpreted_batch_ndims` exceeds
`distribution.batch_ndims`
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
name = name or "Independent" + distribution.name
self._distribution = distribution
with ops.name_scope(name) as name:
Raises:
TypeError: if `concentration` and `rate` are different dtypes.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[concentration, rate]) as name:
with ops.control_dependencies([
check_ops.assert_positive(concentration),
validate_args=False,
allow_nan_stats=True,
name="InverseGammaWithSoftplusConcentrationRate"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[concentration, rate]) as name:
super(InverseGammaWithSoftplusConcentrationRate, self).__init__(
concentration=nn.softplus(concentration,
from tensorflow.python.ops import nn_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
-from tensorflow.python.ops.distributions import util as distribution_util
class Logistic(distribution.Distribution):
Raises:
TypeError: if loc and scale are different dtypes.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[loc, scale]) as name:
with ops.control_dependencies([check_ops.assert_positive(scale)] if
validate_args else []):
matching static batch shapes, or all components do not
have matching static event shapes.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
if not isinstance(cat, categorical.Categorical):
raise TypeError("cat must be a Categorical distribution, but saw: %s" %
cat)
ValueError: if `mixture_distribution` categories does not equal
`components_distribution` rightmost batch shape.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name) as name:
self._mixture_distribution = mixture_distribution
self._components_distribution = components_distribution
Raises:
ValueError: if at most `scale_identity_multiplier` is specified.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name) as name:
with ops.name_scope("init", values=[
loc, scale_diag, scale_identity_multiplier]):
validate_args=False,
allow_nan_stats=True,
name="MultivariateNormalDiagWithSoftplusScale"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[scale_diag]) as name:
super(MultivariateNormalDiagWithSoftplusScale, self).__init__(
loc=loc,
Raises:
ValueError: if at most `scale_identity_multiplier` is specified.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
def _convert_to_tensor(x, name):
return None if x is None else ops.convert_to_tensor(x, name=name)
with ops.name_scope(name) as name:
from tensorflow.python.ops import check_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import linalg_ops
-from tensorflow.python.ops.distributions import util as distribution_util
__all__ = [
Raises:
ValueError: if neither `loc` nor `covariance_matrix` are specified.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
# Convert the covariance_matrix up to a scale_tril and call MVNTriL.
with ops.name_scope(name) as name:
ValueError: if `scale` is unspecified.
TypeError: if not `scale.dtype.is_floating`
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
if scale is None:
raise ValueError("Missing required `scale` parameter.")
if not scale.dtype.is_floating:
Raises:
ValueError: if neither `loc` nor `scale_tril` are specified.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
def _convert_to_tensor(x, name):
return None if x is None else ops.convert_to_tensor(x, name=name)
if loc is None and scale_tril is None:
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[total_count, logits, probs]) as name:
self._logits, self._probs = distribution_util.get_logits_and_probs(
logits, probs, validate_args=validate_args, name=name)
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[logits, probs]) as name:
self._logits, self._probs = distribution_util.get_logits_and_probs(
name=name, logits=logits, probs=probs, validate_args=validate_args,
TypeError: if `rate` is not a float-type.
TypeError: if `log_rate` is not a float-type.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[rate]) as name:
if (rate is None) == (log_rate is None):
raise ValueError("Must specify exactly one of `rate` and `log_rate`.")
TypeError: if `quadrature_grid` and `quadrature_probs` have different base
`dtype`.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[loc, scale]) as name:
if loc is not None:
loc = ops.convert_to_tensor(loc, name="loc")
`Distribution` or continuous.
NotImplementedError: If the base distribution does not implement `cdf`.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
values = (
list(distribution.parameters.values()) +
[low, high])
Raises:
ValueError: If both `probs` and `logits` are passed, or if neither.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[logits, probs, temperature]) as name:
with ops.control_dependencies([check_ops.assert_positive(temperature)]
if validate_args else []):
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[logits, probs, temperature]) as name:
self._logits, self._probs = distribution_util.get_logits_and_probs(
if one or more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name,
values=[loc, scale, skewness, tailweight]) as name:
ValueError: if `not distribution.is_scalar_batch`.
ValueError: if `not distribution.is_scalar_event`.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[mix_loc, temperature]) as name:
if not scale or len(scale) < 2:
raise ValueError("Must specify list (or list-like object) of scale "
Raises:
ValueError: if at most `scale_identity_multiplier` is specified.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name) as name:
with ops.name_scope("init", values=[
loc, scale_diag, scale_identity_multiplier]):
ValueError: if `scale` is unspecified.
TypeError: if not `scale.dtype.is_floating`
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
if scale is None:
raise ValueError("Missing required `scale` parameter.")
if not scale.dtype.is_floating:
Raises:
ValueError: if at most `scale_identity_multiplier` is specified.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name):
with ops.name_scope("init", values=[
loc, scale_diag, scale_identity_multiplier]):
ValueError: if `scale` is unspecified.
TypeError: if not `scale.dtype.is_floating`
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
if scale is None:
raise ValueError("Missing required `scale` parameter.")
if not scale.dtype.is_floating:
Raises:
ValueError: if at most `scale_identity_multiplier` is specified.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(
name,
if one or more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
graph_parents = [df, loc, scale_identity_multiplier, scale_diag,
scale_tril, scale_perturb_factor, scale_perturb_diag]
with ops.name_scope(name) as name:
ValueError: if df < k, where scale operator event shape is
`(k, k)`
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
self._cholesky_input_output_matrices = cholesky_input_output_matrices
with ops.name_scope(name) as name:
with ops.name_scope("init", values=[df, scale_operator]):
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[scale]) as name:
with ops.name_scope("init", values=[scale]):
scale = ops.convert_to_tensor(scale)
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name) as name:
with ops.name_scope("init", values=[scale]):
scale = ops.convert_to_tensor(scale)
Raises:
ValueError: If p and logits are passed, or if neither are passed.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name) as name:
self._logits, self._probs = distribution_util.get_logits_and_probs(
logits=logits,
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[concentration1, concentration0]) as name:
self._concentration1 = self._maybe_assert_valid_concentration(
ops.convert_to_tensor(concentration1, name="concentration1"),
validate_args=False,
allow_nan_stats=True,
name="BetaWithSoftplusConcentration"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[concentration1,
concentration0]) as name:
super(BetaWithSoftplusConcentration, self).__init__(
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[logits, probs]) as name:
self._logits, self._probs = distribution_util.get_logits_and_probs(
logits=logits,
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[concentration]) as name:
self._concentration = self._maybe_assert_valid_concentration(
ops.convert_to_tensor(concentration, name="concentration"),
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[total_count, concentration]) as name:
# Broadcasting works because:
# * The broadcasting convention is to prepend dimensions of size [1], and
"""Dictionary of parameters used to instantiate this `Distribution`."""
# Remove "self", "__class__", or other special variables. These can appear
# if the subclass used:
- # `parameters = distribution_util.parent_frame_arguments()`.
+ # `parameters = dict(locals())`.
return dict((k, v) for k, v in self._parameters.items()
if not k.startswith("__") and k != "self")
from tensorflow.python.ops import nn
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import gamma
-from tensorflow.python.ops.distributions import util as distribution_util
from tensorflow.python.util.tf_export import tf_export
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
# Even though all statistics of are defined for valid inputs, this is not
# true in the parent class "Gamma." Therefore, passing
# allow_nan_stats=True
validate_args=False,
allow_nan_stats=True,
name="ExponentialWithSoftplusRate"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[rate]) as name:
super(ExponentialWithSoftplusRate, self).__init__(
rate=nn.softplus(rate, name="softplus_rate"),
Raises:
TypeError: if `concentration` and `rate` are different dtypes.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[concentration, rate]) as name:
with ops.control_dependencies([
check_ops.assert_positive(concentration),
validate_args=False,
allow_nan_stats=True,
name="GammaWithSoftplusConcentrationRate"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[concentration, rate]) as name:
super(GammaWithSoftplusConcentrationRate, self).__init__(
concentration=nn.softplus(concentration,
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import special_math
-from tensorflow.python.ops.distributions import util as distribution_util
from tensorflow.python.util.tf_export import tf_export
Raises:
TypeError: if `loc` and `scale` are of different dtype.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[loc, scale]) as name:
with ops.control_dependencies([check_ops.assert_positive(scale)] if
validate_args else []):
validate_args=False,
allow_nan_stats=True,
name="LaplaceWithSoftplusScale"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[loc, scale]) as name:
super(LaplaceWithSoftplusScale, self).__init__(
loc=loc,
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[total_count, logits, probs]) as name:
self._total_count = ops.convert_to_tensor(total_count, name="total_count")
if validate_args:
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import special_math
-from tensorflow.python.ops.distributions import util as distribution_util
from tensorflow.python.util.tf_export import tf_export
Raises:
TypeError: if `loc` and `scale` have different `dtype`.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[loc, scale]) as name:
with ops.control_dependencies([check_ops.assert_positive(scale)] if
validate_args else []):
validate_args=False,
allow_nan_stats=True,
name="NormalWithSoftplusScale"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[scale]) as name:
super(NormalWithSoftplusScale, self).__init__(
loc=loc,
Raises:
TypeError: if loc and scale are different dtypes.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[df, loc, scale]) as name:
with ops.control_dependencies([check_ops.assert_positive(df)]
if validate_args else []):
validate_args=False,
allow_nan_stats=True,
name="StudentTWithAbsDfSoftplusScale"):
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[df, scale]) as name:
super(StudentTWithAbsDfSoftplusScale, self).__init__(
df=math_ops.floor(math_ops.abs(df)),
name: Python `str` name prefixed to Ops created by this class. Default:
`bijector.name + distribution.name`.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
name = name or (("" if bijector is None else bijector.name) +
distribution.name)
with ops.name_scope(name, values=[event_shape, batch_shape]) as name:
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
-from tensorflow.python.ops.distributions import util as distribution_util
from tensorflow.python.util.tf_export import tf_export
Raises:
InvalidArgumentError: if `low >= high` and `validate_args=False`.
"""
- parameters = distribution_util.parent_frame_arguments()
+ parameters = dict(locals())
with ops.name_scope(name, values=[low, high]) as name:
with ops.control_dependencies([
check_ops.assert_less(