Python Forum
Making a Basic Keras Model - Input Shape and Parameters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a Basic Keras Model - Input Shape and Parameters
Hey Guys!

I am currently trying to build a simple model which I plan to use to make predictions. The idea for this model is to have each of the 202-dimensional vectors in an array (300 in total) be fitted (using to a 1 dimensional vector containing a single integer (also 300 in total). Currently, I have two numpy arrays with the following dimensions: [300,202] and [300,]. I am really having difficulty constructing this model. Here is the current code that I have:

model = tf.keras.Sequential()

model.add(tf.keras.layers.Dense(128, activation="relu"))

model.compile(loss = "mean_squared_error", optimizer=tf.keras.optimizers.Adam(0.1))

#"states" has shape [300,202] and "actions" has shape[300,]

history =, actions, epochs = 1, verbose=False)

Here is the error message that I keep getting:
"ValueError: Error when checking input: expected input_1 to have shape (202,) but got array with shape (1,)"
Any help that you guys could provide would be great! I'd be more than happy to clarify anything!

Possibly Related Threads…
Thread Author Replies Views Last Post
  Understanding Keras and TensorFlow and how to use them bytecrunch 1 555 Mar-11-2021, 02:40 PM
Last Post: jefsummers
  Problems feeding live input from my microphone into a keras model (SegFault: 11) zeptozetta 1 872 Sep-14-2020, 03:08 AM
Last Post: zeptozetta
  Keras.Predict into Dataframe Finpyth 13 2,898 Aug-31-2020, 07:22 AM
Last Post: hussainmujtaba
  cannot reshape array of size 0 into shape Roro 2 3,034 Jun-14-2020, 11:28 AM
Last Post: Roro
  Error when import Keras Azadfalah 1 838 Apr-29-2020, 04:45 AM
Last Post: buran
  Keras + Matplotlib causing crash spearced 3 1,848 Feb-06-2020, 04:54 PM
Last Post: zljt3216
  Keras Dense layer with wrong input d1r4c 0 649 Jan-02-2020, 02:35 PM
Last Post: d1r4c
  Bad input shape for SVC Scott 1 2,608 Dec-07-2019, 08:03 AM
Last Post: scidam
  Keras: Time series classification midarq 0 939 Sep-25-2019, 09:03 AM
Last Post: midarq
  Keras. ModuleNotFoundError: No module named 'error' agatte 1 4,259 Sep-18-2019, 12:27 PM
Last Post: shivani

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020