Example #1
0
def _SigmoidGrad(op, grad):
    """Returns grad * sigmoid(x) * (1 - sigmoid(x))."""
    y = op.outputs[0]  # y = sigmoid(x)
    with ops.control_dependencies([grad.op]):
        if y.dtype.is_complex:
            y = math_ops.conj(y)
        return gen_math_ops._sigmoid_grad(y, grad)
Example #2
0
def _SigmoidGradGrad(op, grad):
  with ops.control_dependencies([grad.op]):
    a = math_ops.conj(op.inputs[0])
    b = math_ops.conj(op.inputs[1])
    gb = grad * b
    # pylint: disable=protected-access
    return gb - 2.0 * gb * a, gen_math_ops._sigmoid_grad(a, grad)
Example #3
0
def _SigmoidGrad(op, grad):
  """Returns grad * sigmoid(x) * (1 - sigmoid(x))."""
  y = op.outputs[0]  # y = sigmoid(x)
  with ops.control_dependencies([grad.op]):
    y = math_ops.conj(y)
    # pylint: disable=protected-access
    return gen_math_ops._sigmoid_grad(y, grad)
Example #4
0
def _SigmoidGradGrad(op, grad):
    with ops.control_dependencies([grad]):
        a = math_ops.conj(op.inputs[0])
        b = math_ops.conj(op.inputs[1])
        gb = grad * b
        # pylint: disable=protected-access
        return gb - 2.0 * gb * a, gen_math_ops._sigmoid_grad(a, grad)
Example #5
0
def _SigmoidGrad(op, grad):
    """Returns grad * sigmoid(x) * (1 - sigmoid(x))."""
    y = op.outputs[0]  # y = sigmoid(x)
    with ops.control_dependencies([grad]):
        y = math_ops.conj(y)
        # pylint: disable=protected-access
        return gen_math_ops._sigmoid_grad(y, grad)
Example #6
0
def _SigmoidGrad(op, grad):
  """Returns grad * sigmoid(x) * (1 - sigmoid(x))."""
  y = op.outputs[0]  # y = sigmoid(x)
  with ops.control_dependencies([grad.op]):
    if y.dtype.is_complex:
      y = math_ops.conj(y)
    return gen_math_ops._sigmoid_grad(y, grad)