Exemple #1
0
def is_generator_or_sequence(x):
    """Check if `x` is a Keras generator type."""
    builtin_iterators = (str, list, tuple, dict, set, frozenset)
    if isinstance(x, (ops.Tensor, np.ndarray) + builtin_iterators):
        return False
    return tf_inspect.isgenerator(x) or isinstance(x,
                                                   Sequence) or is_iterator(x)
Exemple #2
0
 def can_handle(x, y=None):
     return tf_inspect.isgenerator(x)
Exemple #3
0
def is_generator_or_sequence(x):
  """Check if `x` is a Keras generator type."""
  return tf_inspect.isgenerator(x) or isinstance(x, Sequence)