本文整理汇总了Python中tensorflow.python.ops.nn.softplus函数的典型用法代码示例。如果您正苦于以下问题:Python softplus函数的具体用法?Python softplus怎么用?Python softplus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了softplus函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,
alpha,
beta,
validate_args=False,
allow_nan_stats=True,
name="GammaWithSoftplusAlphaBeta"):
with ops.name_scope(name, values=[alpha, beta]) as ns:
super(GammaWithSoftplusAlphaBeta, self).__init__(
alpha=nn.softplus(alpha),
beta=nn.softplus(beta),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=ns)
开发者ID:Nishant23,项目名称:tensorflow,代码行数:13,代码来源:gamma.py
示例2: __init__
def __init__(self,
a,
b,
validate_args=False,
allow_nan_stats=True,
name="BetaWithSoftplusAB"):
with ops.name_scope(name, values=[a, b]) as ns:
super(BetaWithSoftplusAB, self).__init__(
a=nn.softplus(a),
b=nn.softplus(b),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=ns)
开发者ID:cg31,项目名称:tensorflow,代码行数:13,代码来源:beta.py
示例3: __init__
def __init__(
self, alpha, beta, validate_args=False, allow_nan_stats=True, name="InverseGammaWithSoftplusAlphaBeta"
):
parameters = locals()
parameters.pop("self")
with ops.name_scope(name, values=[alpha, beta]) as ns:
super(InverseGammaWithSoftplusAlphaBeta, self).__init__(
alpha=nn.softplus(alpha),
beta=nn.softplus(beta),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=ns,
)
self._parameters = parameters
开发者ID:kdavis-mozilla,项目名称:tensorflow,代码行数:14,代码来源:inverse_gamma.py
示例4: __init__
def __init__(self,
concentration,
rate,
validate_args=False,
allow_nan_stats=True,
name="GammaWithSoftplusConcentrationRate"):
parameters = distribution_util.parent_frame_arguments()
with ops.name_scope(name, values=[concentration, rate]) as name:
super(GammaWithSoftplusConcentrationRate, self).__init__(
concentration=nn.softplus(concentration,
name="softplus_concentration"),
rate=nn.softplus(rate, name="softplus_rate"),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=name)
self._parameters = parameters
开发者ID:didukhle,项目名称:tensorflow,代码行数:16,代码来源:gamma.py
示例5: __init__
def __init__(self,
a,
b,
validate_args=False,
allow_nan_stats=True,
name="BetaWithSoftplusAB"):
parameters = locals()
parameters.pop("self")
with ops.name_scope(name, values=[a, b]) as ns:
super(BetaWithSoftplusAB, self).__init__(
a=nn.softplus(a, name="softplus_a"),
b=nn.softplus(b, name="softplus_b"),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=ns)
self._parameters = parameters
开发者ID:ivankreso,项目名称:tensorflow,代码行数:16,代码来源:beta.py
示例6: _entropy
def _entropy(self):
probs = self._probs
if self.validate_args:
probs = control_flow_ops.with_dependencies(
[check_ops.assert_less(
probs,
constant_op.constant(1., probs.dtype),
message="Entropy is undefined when logits = inf or probs = 1.")],
probs)
# Claim: entropy(p) = softplus(s)/p - s
# where s=logits and p=probs.
#
# Proof:
#
# entropy(p)
# := -[(1-p)log(1-p) + plog(p)]/p
# = -[log(1-p) + plog(p/(1-p))]/p
# = -[-softplus(s) + ps]/p
# = softplus(s)/p - s
#
# since,
# log[1-sigmoid(s)]
# = log[1/(1+exp(s)]
# = -log[1+exp(s)]
# = -softplus(s)
#
# using the fact that,
# 1-sigmoid(s) = sigmoid(-s) = 1/(1+exp(s))
return nn.softplus(self.logits) / probs - self.logits
开发者ID:Ajaycs99,项目名称:tensorflow,代码行数:29,代码来源:geometric.py
示例7: __init__
def __init__(self,
concentration,
rate,
validate_args=False,
allow_nan_stats=True,
name="InverseGammaWithSoftplusConcentrationRate"):
parameters = dict(locals())
with ops.name_scope(name, values=[concentration, rate]) as name:
super(InverseGammaWithSoftplusConcentrationRate, self).__init__(
concentration=nn.softplus(concentration,
name="softplus_concentration"),
rate=nn.softplus(rate, name="softplus_rate"),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=name)
self._parameters = parameters
开发者ID:AnishShah,项目名称:tensorflow,代码行数:16,代码来源:inverse_gamma.py
示例8: __init__
def __init__(self, lam, validate_args=False, allow_nan_stats=True, name="ExponentialWithSoftplusLam"):
parameters = locals()
parameters.pop("self")
with ops.name_scope(name, values=[lam]) as ns:
super(ExponentialWithSoftplusLam, self).__init__(
lam=nn.softplus(lam), validate_args=validate_args, allow_nan_stats=allow_nan_stats, name=ns
)
self._parameters = parameters
开发者ID:kdavis-mozilla,项目名称:tensorflow,代码行数:8,代码来源:exponential.py
示例9: __init__
def __init__(self, loc, scale, validate_args=False, allow_nan_stats=True, name="LaplaceWithSoftplusScale"):
parameters = locals()
parameters.pop("self")
with ops.name_scope(name, values=[loc, scale]) as ns:
super(LaplaceWithSoftplusScale, self).__init__(
loc=loc, scale=nn.softplus(scale), validate_args=validate_args, allow_nan_stats=allow_nan_stats, name=ns
)
self._parameters = parameters
开发者ID:kdavis-mozilla,项目名称:tensorflow,代码行数:8,代码来源:laplace.py
示例10: _kl_bernoulli_bernoulli
def _kl_bernoulli_bernoulli(a, b, name=None):
"""Calculate the batched KL divergence KL(a || b) with a and b Bernoulli.
Args:
a: instance of a Bernoulli distribution object.
b: instance of a Bernoulli distribution object.
name: (optional) Name to use for created operations.
default is "kl_bernoulli_bernoulli".
Returns:
Batchwise KL(a || b)
"""
with ops.name_scope(name, "kl_bernoulli_bernoulli", [a.logits, b.logits]):
return (math_ops.sigmoid(a.logits) * (-nn.softplus(-a.logits) +
nn.softplus(-b.logits)) +
math_ops.sigmoid(-a.logits) * (-nn.softplus(a.logits) +
nn.softplus(b.logits)))
开发者ID:Hwhitetooth,项目名称:tensorflow,代码行数:17,代码来源:bernoulli.py
示例11: __init__
def __init__(self,
concentration1,
concentration0,
validate_args=False,
allow_nan_stats=True,
name="BetaWithSoftplusConcentration"):
parameters = dict(locals())
with ops.name_scope(name, values=[concentration1,
concentration0]) as name:
super(BetaWithSoftplusConcentration, self).__init__(
concentration1=nn.softplus(concentration1,
name="softplus_concentration1"),
concentration0=nn.softplus(concentration0,
name="softplus_concentration0"),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=name)
self._parameters = parameters
开发者ID:AnishShah,项目名称:tensorflow,代码行数:18,代码来源:beta.py
示例12: __init__
def __init__(self, df, mu, sigma, validate_args=False, allow_nan_stats=True, name="StudentTWithAbsDfSoftplusSigma"):
with ops.name_scope(name, values=[df, mu, sigma]) as ns:
super(StudentTWithAbsDfSoftplusSigma, self).__init__(
df=math_ops.floor(math_ops.abs(df)),
mu=mu,
sigma=nn.softplus(sigma),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=ns,
)
开发者ID:apollos,项目名称:tensorflow,代码行数:10,代码来源:student_t.py
示例13: softplus
def softplus(x):
"""Softplus activation function.
Arguments:
x: Input tensor.
Returns:
The softplus activation: `log(exp(x) + 1)`.
"""
return nn.softplus(x)
开发者ID:kylin9872,项目名称:tensorflow,代码行数:10,代码来源:activations.py
示例14: __init__
def __init__(
self, mu, diag_stdev, validate_args=False, allow_nan_stats=True, name="MultivariateNormalDiagWithSoftplusStdDev"
):
with ops.name_scope(name, values=[mu, diag_stdev]) as ns:
super(MultivariateNormalDiagWithSoftplusStDev, self).__init__(
mu=mu,
diag_stdev=nn.softplus(diag_stdev),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=ns,
)
开发者ID:rhuangq,项目名称:tensorflow,代码行数:11,代码来源:mvn.py
示例15: __init__
def __init__(self,
rate,
validate_args=False,
allow_nan_stats=True,
name="ExponentialWithSoftplusRate"):
parameters = locals()
with ops.name_scope(name, values=[rate]) as name:
super(ExponentialWithSoftplusRate, self).__init__(
rate=nn.softplus(rate, name="softplus_rate"),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=name)
self._parameters = parameters
开发者ID:Jackiefan,项目名称:tensorflow,代码行数:13,代码来源:exponential.py
示例16: __init__
def __init__(self,
mu,
sigma,
validate_args=False,
allow_nan_stats=True,
name="NormalWithSoftplusSigma"):
with ops.name_scope(name, values=[mu, sigma]) as ns:
super(NormalWithSoftplusSigma, self).__init__(
mu=mu,
sigma=nn.softplus(sigma),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=ns)
开发者ID:KalraA,项目名称:tensorflow,代码行数:13,代码来源:normal.py
示例17: __init__
def __init__(self,
loc,
scale,
validate_args=False,
allow_nan_stats=True,
name="LaplaceWithSoftplusScale"):
parameters = distribution_util.parent_frame_arguments()
with ops.name_scope(name, values=[loc, scale]) as name:
super(LaplaceWithSoftplusScale, self).__init__(
loc=loc,
scale=nn.softplus(scale, name="softplus_scale"),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=name)
self._parameters = parameters
开发者ID:didukhle,项目名称:tensorflow,代码行数:15,代码来源:laplace.py
示例18: __init__
def __init__(self,
loc,
scale_diag,
validate_args=False,
allow_nan_stats=True,
name="MultivariateNormalDiagWithSoftplusScale"):
parameters = dict(locals())
with ops.name_scope(name, values=[scale_diag]) as name:
super(MultivariateNormalDiagWithSoftplusScale, self).__init__(
loc=loc,
scale_diag=nn.softplus(scale_diag),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=name)
self._parameters = parameters
开发者ID:AnishShah,项目名称:tensorflow,代码行数:15,代码来源:mvn_diag.py
示例19: __init__
def __init__(self,
loc,
scale,
validate_args=False,
allow_nan_stats=True,
name="NormalWithSoftplusScale"):
parameters = locals()
with ops.name_scope(name, values=[scale]):
super(NormalWithSoftplusScale, self).__init__(
loc=loc,
scale=nn.softplus(scale, name="softplus_scale"),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=name)
self._parameters = parameters
开发者ID:ChengYuXiang,项目名称:tensorflow,代码行数:15,代码来源:normal.py
示例20: __init__
def __init__(self,
mu,
diag_stdev,
validate_args=False,
allow_nan_stats=True,
name="MultivariateNormalDiagWithSoftplusStdDev"):
parameters = locals()
parameters.pop("self")
with ops.name_scope(name, values=[diag_stdev]) as ns:
super(MultivariateNormalDiagWithSoftplusStDev, self).__init__(
mu=mu,
diag_stdev=nn.softplus(diag_stdev),
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
name=ns)
self._parameters = parameters
开发者ID:kadeng,项目名称:tensorflow,代码行数:16,代码来源:mvn.py
注:本文中的tensorflow.python.ops.nn.softplus函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论