本文整理汇总了Python中tensorflow.python.ops.math_ops.polygamma函数的典型用法代码示例。如果您正苦于以下问题:Python polygamma函数的具体用法?Python polygamma怎么用?Python polygamma使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了polygamma函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _PolygammaGrad
def _PolygammaGrad(op, grad):
"""Returns gradient of psi(n, x) with respect to n and x."""
# TODO(tillahoffmann): Add derivative with respect to n
n = op.inputs[0]
x = op.inputs[1]
# Broadcast gradients
sn = array_ops.shape(n)
sx = array_ops.shape(x)
unused_rn, rx = gen_array_ops._broadcast_gradient_args(sn, sx)
# Evaluate gradient
with ops.control_dependencies([grad.op]):
partial_x = math_ops.polygamma(n + 1, x)
return (None, array_ops.reshape(math_ops.reduce_sum(partial_x * grad, rx), sx))
开发者ID:ChanningPing,项目名称:tensorflow,代码行数:13,代码来源:math_grad.py
示例2: _PolygammaGrad
def _PolygammaGrad(op, grad):
"""Returns gradient of psi(n, x) with respect to n and x."""
# TODO(tillahoffmann): Add derivative with respect to n
n = op.inputs[0]
x = op.inputs[1]
# Broadcast gradients
sn = array_ops.shape(n)
sx = array_ops.shape(x)
# pylint: disable=protected-access
unused_rn, rx = gen_array_ops._broadcast_gradient_args(sn, sx)
# pylint: enable=protected-access
# Evaluate gradient
with ops.control_dependencies([grad]):
n = math_ops.conj(n)
x = math_ops.conj(x)
partial_x = math_ops.polygamma(n + 1, x)
# TODO(b/36815900): Mark None return values as NotImplemented
return (None,
array_ops.reshape(math_ops.reduce_sum(partial_x * grad, rx), sx))
开发者ID:neuroradiology,项目名称:tensorflow,代码行数:19,代码来源:math_grad.py
示例3: _DigammaGrad
def _DigammaGrad(op, grad):
"""Compute gradient of the digamma function with respect to its argument."""
x = op.inputs[0]
with ops.control_dependencies([grad]):
x = math_ops.conj(x)
return grad * math_ops.polygamma(array_ops.constant(1, dtype=x.dtype), x)
开发者ID:neuroradiology,项目名称:tensorflow,代码行数:6,代码来源:math_grad.py
示例4: safe_polygamma
def safe_polygamma(x, y):
return math_ops.polygamma(
math_ops.round(clip_ops.clip_by_value(y, 1, 10)), x * x + 1)
开发者ID:kylin9872,项目名称:tensorflow,代码行数:3,代码来源:map_vectorization_test.py
注:本文中的tensorflow.python.ops.math_ops.polygamma函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论