parameters: (op, grad)
return_statement: return array_ops.gather(scaled_grad, op.inputs[1]), None
docstring: Gradient for SegmentMean.
docstring_summary: Gradient for SegmentMean.
docstring_tokens: Gradient for SegmentMean .
function: def _SegmentMeanGrad(op, grad):
    """Gradient for SegmentMean."""
    input_rank = array_ops.rank(op.inputs[0])
    ones_shape = array_ops.concat([
        array_ops.shape(op.inputs[1]),
        array_ops.fill(array_ops.expand_dims(input_rank - 1, 0), 1)
    ], 0)
    ones = array_ops.fill(ones_shape,
                          constant_op.constant(1, dtype=grad.dtype))
    scaled_grad = math_ops.div(grad, math_ops.segment_sum(ones, op.inputs[1]))
    return array_ops.gather(scaled_grad, op.inputs[1]), None
function_tokens: def _SegmentMeanGrad ( op , grad ) : input_rank = array_ops . rank ( op . inputs [ 0 ] ) ones_shape = array_ops . concat ( [ array_ops . shape ( op . inputs [ 1 ] ) , array_ops . fill ( array_ops . expand_dims ( input_rank - 1 , 0 ) , 1 ) ] , 0 ) ones = array_ops . fill ( ones_shape , constant_op . constant ( 1 , dtype = grad . dtype ) ) scaled_grad = math_ops . div ( grad , math_ops . segment_sum ( ones , op . inputs [ 1 ] ) ) return array_ops . gather ( scaled_grad , op . inputs [ 1 ] ) , None