from tensorflow.python.framework import ops


  Raises:
    ValueError: if `multiple` is less than 1, or `dim` is not in
    `[-rank(tensor), rank(tensor)]`.
  """
  if multiple < 1:
    raise ValueError('Invalid multiple %s, must be > 0.' % multiple)
  with ops.name_scope(
      name, 'expand_and_tile', (tensor, multiple, dim)) as scope:
    # Sparse.
    if isinstance(tensor, ops.SparseTensorValue):
      tensor = ops.SparseTensor.from_value(tensor)
    if isinstance(tensor, ops.SparseTensor):
      if dim < 0:
