def METHOD_NAME(elements, element_dtype, element_shape):
  """Validates the inputs of tensor_list."""
  if element_dtype is not None and element_shape is not None:
    return
  if tensor_util.is_tensor(elements):
    return
  if isinstance(elements, (list, tuple)):
    if elements:
      return
    else:
      raise ValueError(
          'element_dtype and element_shape are required when elements are'
          ' empty')
  raise ValueError(
      'unknown type for elements: {}; only Tensor, list and tuple are'
      ' allowed'.format(type(elements)))