Hey there,
maybe some of you can help me to drop me off from misunderstanding list of input_shape.
I am using dataset to gen data.
The window is 10, and I divide x with size 5 and y with size 5.
Then the dataset will go ahead to the model, I just work with a simple Sequential one and give input_shape (3,1) to to first layer, fe. lstm.
I can fit the model.
I predict  random values from (1, 1) as input_shape to (10, 1) as input_shape.
So what does input_shape mean actually? I lost it so deeply…
Full code:
import numpy as np
import tensorflow as tf

data = np.random.randn(5000)
data = data[...,np.newaxis]

sp = int(len(data) * .5)
train_data = data[:sp]
valid_data = data[sp:] 

def windowed_set(data): 
  win_sz=10
  ds = tf.data.Dataset.from_tensor_slices(data)
  ds = ds.window(size=win_sz, shift=1, drop_remainder=True).flat_map(lambda w: w.batch(win_sz))
  ds = ds.shuffle(win_sz).map(lambda w: (w[:int(win_sz*0.5)], w[int(win_sz*0.5):])) 
  ds = ds.batch(32).prefetch(1)
  return ds

train_set  = windowed_set(train_data)
valid_set = windowed_set(valid_data) 

#Model definition
model = tf.keras.models.Sequential([                           
   tf.keras.layers.LSTM(32, 
                        input_shape=[3, 1],
                        return_sequences=True),
   tf.keras.layers.Dense(1)                                
])

model.summary()
model.compile(loss=tf.keras.losses.Huber(), 
              optimizer=tf.keras.optimizers.Adam())


#Training
model.fit(train_set,
          validation_data=valid_set,
          epochs=50, 
          verbose=0)

#Prediction
for i in range(1, 11):
  print(f"prediction {i} bit:")
  pred_input = np.random.rand(i)
  pred_input = np.expand_dims(pred_input, axis=-1)
  print(pred_input.shape)
  pred = model.predict(np.reshape(pred_input, (1,) + pred_input.shape))
  print(pred)
  print()