0

我的 input_shape 参数有一些问题:有谁可以帮助我:((

x_train:520 个数据,每个序列 15 个样本,3 个特征:[1sample[1sequence_for_one_sample[3 个数据用于 3 个特征]]]

y_train : (520,1)

model = Sequential()  


model.add(LSTM(64,activation='relu', input_shape=(train_x.shape[1],train_x.shape[2],train_x.shape[2]),return_sequences = True))
    
model.add(LSTM(32,activation='relu',return_sequences = False))
    
model.add(Dropout(0,2))

model.add(Dense(train_y.shape[1]))
    
model.compile(optimizer='adam',loss='mse')
 
model.summary()


history = model.fit(train_x,train_y,epochs=10,batch_size=16,validation_split=0.1,verbose=True)


ERROR : 
  TypeError: 'int' object is not iterable



  File "<ipython-input-414-ce6d26e35c7a>", line 16, in <module>
    history = model.fit(train_x,train_y,epochs=10,batch_size=16,validation_split=0.1,verbose=True)

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 1100, in fit
    tmp_logs = self.train_function(iterator)

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 828, in _call_
    result = self._call(*args, **kwds)

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 871, in _call
    self._initialize(args, kwds, add_initializers_to=initializers)

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 725, in _initialize
    self._stateful_fn._get_concrete_function_internal_garbage_collected(  # pylint: disable=protected-access

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2969, in _get_concrete_function_internal_garbage_collected
    graph_function, _ = self._maybe_define_function(args, kwargs)

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3361, in _maybe_define_function
    graph_function = self._create_graph_function(args, kwargs)

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3196, in _create_graph_function
    func_graph_module.func_graph_from_py_func(

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 990, in func_graph_from_py_func
    func_outputs = python_func(*func_args, **func_kwargs)

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 634, in wrapped_fn
    out = weak_wrapped_fn().__wrapped__(*args, **kwds)

  File "/Users/pierreesteves/.local/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 977, in wrapper
    raise e.ag_error_metadata.to_exception(e)
4

0 回答 0