def aggregate_tensors_or_indexed_slices(values, accumulation_fn=math_ops.add_n):
    'Aggregate tensors using `accumulation_fn` and IndexedSlices via concat.'
    if any((isinstance(v, ops.IndexedSlices) for v in values)):
        return gradients_impl._AggregateIndexedSlicesGradients(values)
    else:
        return accumulation_fn(values)
Aggregate tensors using `accumulation_fn` and IndexedSlices via concat.
def aggregate_tensors_or_indexed_slices(values, accumulation_fn=math_ops.add_n):
    
    if any((isinstance(v, ops.IndexedSlices) for v in values)):
        return gradients_impl._AggregateIndexedSlicesGradients(values)
    else:
        return accumulation_fn(values)