本文整理汇总了Python中tensorflow.python.ops.math_ops.zeta函数的典型用法代码示例。如果您正苦于以下问题:Python zeta函数的具体用法?Python zeta怎么用?Python zeta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zeta函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _ZetaGrad
def _ZetaGrad(op, grad):
"""Returns gradient of zeta(x, q) with respect to x and q."""
# TODO(tillahoffmann): Add derivative with respect to x
x = op.inputs[0]
q = op.inputs[1]
# Broadcast gradients
sx = array_ops.shape(x)
sq = array_ops.shape(q)
unused_rx, rq = gen_array_ops._broadcast_gradient_args(sx, sq)
# Evaluate gradient
with ops.control_dependencies([grad.op]):
partial_q = -x * math_ops.zeta(x + 1, q)
return (None, array_ops.reshape(math_ops.reduce_sum(partial_q * grad, rq), sq))
示例2: _ZetaGrad
def _ZetaGrad(op, grad):
"""Returns gradient of zeta(x, q) with respect to x and q."""
# TODO(tillahoffmann): Add derivative with respect to x
x = op.inputs[0]
q = op.inputs[1]
# Broadcast gradients
sx = array_ops.shape(x)
sq = array_ops.shape(q)
# pylint: disable=protected-access
unused_rx, rq = gen_array_ops._broadcast_gradient_args(sx, sq)
# pylint: enable=protected-access
# Evaluate gradient
with ops.control_dependencies([grad]):
x = math_ops.conj(x)
q = math_ops.conj(q)
partial_q = -x * math_ops.zeta(x + 1, q)
# TODO(b/36815900): Mark None return values as NotImplemented
return (None,
array_ops.reshape(math_ops.reduce_sum(partial_q * grad, rq), sq))
示例3: safe_zeta
def safe_zeta(x, y):
return math_ops.zeta(x * x + 1, y * y)