gdn.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:tefla 作者: openAGI 项目源码 文件源码
def _lower_bound_grad(op, grad):
    """Gradient for `_lower_bound`.
    Args:
      op: the tensorflow op for which to calculate a gradient
      grad: gradient with respect to the output of the op
    Returns:
      gradients with respect to the inputs of the op
    """
    inputs = op.inputs[0]
    bound = op.inputs[1]
    pass_through_if = tf.logical_or(inputs >= bound, grad < 0)
    return [tf.cast(pass_through_if, grad.dtype) * grad, None]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号