parameters: (op, grad, selector_op)
return_statement: return (gx, gy)
docstring: Factor out the code for the gradient of Maximum or Minimum.
docstring_summary: Factor out the code for the gradient of Maximum or Minimum.
docstring_tokens: Factor out the code for the gradient of Maximum or Minimum .
function: def _MaximumMinimumGrad(op, grad, selector_op):
    """Factor out the code for the gradient of Maximum or Minimum."""
    x = op.inputs[0]
    y = op.inputs[1]
    gdtype = grad.dtype
    sx = array_ops.shape(x)
    sy = array_ops.shape(y)
    gradshape = array_ops.shape(grad)
    zeros = array_ops.zeros(gradshape, gdtype)
    xmask = selector_op(x, y)
    rx, ry = gen_array_ops._broadcast_gradient_args(sx, sy)
    xgrad = math_ops.select(xmask, grad, zeros)
    ygrad = math_ops.select(math_ops.logical_not(xmask), grad, zeros)
    gx = array_ops.reshape(math_ops.reduce_sum(xgrad, rx), sx)
    gy = array_ops.reshape(math_ops.reduce_sum(ygrad, ry), sy)
    return (gx, gy)
function_tokens: def _MaximumMinimumGrad ( op , grad , selector_op ) : x = op . inputs [ 0 ] y = op . inputs [ 1 ] gdtype = grad . dtype sx = array_ops . shape ( x ) sy = array_ops . shape ( y ) gradshape = array_ops . shape ( grad ) zeros = array_ops . zeros ( gradshape , gdtype ) xmask = selector_op ( x , y ) rx , ry = gen_array_ops . _broadcast_gradient_args ( sx , sy ) xgrad = math_ops . select ( xmask , grad , zeros ) ygrad = math_ops . select ( math_ops . logical_not ( xmask ) , grad , zeros ) gx = array_ops . reshape ( math_ops . reduce_sum ( xgrad , rx ) , sx ) gy = array_ops . reshape ( math_ops . reduce_sum ( ygrad , ry ) , sy ) return ( gx , gy )