votes up 6

Please provide as model inputs either a single array or a list of arrays. You passed: (param1)=(param1)

Package:
keras
github stars 52268
Exception Class:
ValueError

Raise code

      'Please provide as model inputs either a single array or a list of '
          'arrays. You passed: {}={}'.format(field_name, str(orig_inp)))
  elif isinstance(inp, dict):
    if not allow_dict:
      raise ValueError(
          'You cannot pass a dictionary as model {}.'.format(field_name))
  elif not isinstance(inp, np.ndarray) and not tf.is_tensor(inp):
    raise ValueError(
        'Please provide as model inputs either a single array or a list of '
        'arrays. You passed: {}={}'.format(field_name, orig_inp))


def check_generator_arguments(y=None, sample_weight=None,
                              validation_split=None):
  """Validates arguments passed when using a generator."""
  if
🙏 Scream for help to Ukraine
Today, 3rd July 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

Ways to fix

votes up 1 votes down

Summary: 

This exception is thrown when the validate_input_types function is called. This function takes in 2 parameters: inp and orig_inp. An exception is thrown whenever the inp parameter is a value that is not a list, tuple, dictionary, or ndarray (from numpy). To avoid this exception make sure the value passed to the inp parameter is one of the supported types. The example of what is right and wrong below is simplified, but it highlights what triggers the exception very clearly.

Code to Reproduce the Error (WRONG):

import keras.engine.training_utils_v1 as ktu
import numpy as np

inp = np.array([1,2,3])
orig_inp = np.array([1,2,3])
ktu.validate_input_types(1, orig_inp) # Notice inp is an int

Working Version (Fixed):

import keras.engine.training_utils_v1 as ktu
import numpy as np

inp = np.array([1,2,3])
orig_inp = np.array([1,2,3])
ktu.validate_input_types(inp, orig_inp) # Notice inp is an array

Jul 06, 2021 codingcomedyig answer

Add a possible fix

Please authorize to post fix