@tf_export('math.add_n', 'add_n')
@dispatch.add_dispatch_support
def add_n(inputs, name=None):
    "Adds all input tensors element-wise.\n\n  Converts `IndexedSlices` objects into dense tensors prior to adding.\n\n  Args:\n    inputs: A list of `Tensor` or `IndexedSlices` objects, each with same shape\n      and type.\n    name: A name for the operation (optional).\n\n  Returns:\n    A `Tensor` of same shape and type as the elements of `inputs`.\n\n  Raises:\n    ValueError: If `inputs` don't all have same shape and dtype or the shape\n    cannot be inferred.\n  "
    if ((not inputs) or (not isinstance(inputs, (list, tuple)))):
        raise ValueError('inputs must be a list of at least one Tensor/IndexedSlices with the same dtype and shape')
    inputs = ops.convert_n_to_tensor_or_indexed_slices(inputs)
    if (not all((isinstance(x, (ops.Tensor, ops.IndexedSlices)) for x in inputs))):
        raise ValueError('inputs must be a list of at least one Tensor/IndexedSlices with the same dtype and shape')
    if (len(inputs) == 1):
        if isinstance(inputs[0], ops.IndexedSlices):
            values = ops.convert_to_tensor(inputs[0])
        else:
            values = inputs[0]
        if name:
            return array_ops.identity(values, name=name)
        return values
    return gen_math_ops.add_n(inputs, name=name)
Adds all input tensors element-wise.

Converts `IndexedSlices` objects into dense tensors prior to adding.

Args:
  inputs: A list of `Tensor` or `IndexedSlices` objects, each with same shape
    and type.
  name: A name for the operation (optional).

Returns:
  A `Tensor` of same shape and type as the elements of `inputs`.

Raises:
  ValueError: If `inputs` don't all have same shape and dtype or the shape
  cannot be inferred.
@tf_export('math.add_n', 'add_n')
@dispatch.add_dispatch_support
def add_n(inputs, name=None):
    "Adds all input tensors element-wise.\n\n  Converts `IndexedSlices` objects into dense tensors prior to adding.\n\n  Args:\n    inputs: A list of `Tensor` or `IndexedSlices` objects, each with same shape\n      and type.\n    name: A name for the operation (optional).\n\n  Returns:\n    A `Tensor` of same shape and type as the elements of `inputs`.\n\n  Raises:\n    ValueError: If `inputs` don't all have same shape and dtype or the shape\n    cannot be inferred.\n  "
    if ((not inputs) or (not isinstance(inputs, (list, tuple)))):
        raise ValueError('inputs must be a list of at least one Tensor/IndexedSlices with the same dtype and shape')
    inputs = ops.convert_n_to_tensor_or_indexed_slices(inputs)
    if (not all((isinstance(x, (ops.Tensor, ops.IndexedSlices)) for x in inputs))):
        raise ValueError('inputs must be a list of at least one Tensor/IndexedSlices with the same dtype and shape')
    if (len(inputs) == 1):
        if isinstance(inputs[0], ops.IndexedSlices):
            values = ops.convert_to_tensor(inputs[0])
        else:
            values = inputs[0]
        if name:
            return array_ops.identity(values, name=name)
        return values
    return gen_math_ops.add_n(inputs, name=name)