Traceback (most recent call last)
Input In [37], in <cell line: 4>()
3 model.compile(optimizer, loss)
4 with tf.device(device):
----> 5 history = model.fit(
6 x_train[:100, :1], y_train[:100, :1],
7 validation_data = (x_val[:100, :1], y_val[:100]),
8 callbacks=[monitor, lr_schedule],
9 verbose=1,
10 epochs=10000,
11 batch_size=16,
12 shuffle=False,
13 class_weight={
14 0: y_train.mean(),
15 1: 1 - y_train.mean(),
16 }
17 )
File ~\Anaconda3\lib\site-packages\keras\utils\traceback_utils.py:67, in filter_traceback.<locals>.error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb
File ~\AppData\Local\Temp\__autograph_generated_filezkbe9k_b.py:15, in outer_factory.<locals>.inner_factory.<locals>.tf__train_function(iterator)
13 try:
14 do_return = True
---> 15 retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
16 except:
17 do_return = False
ValueError: in user code:
File "C:\Users\stem\Anaconda3\lib\site-packages\keras\engine\training.py", line 1051, in train_function *
return step_function(self, iterator)
File "C:\Users\stem\Anaconda3\lib\site-packages\keras\engine\training.py", line 1040, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "C:\Users\stem\Anaconda3\lib\site-packages\keras\engine\training.py", line 1030, in run_step **
outputs = model.train_step(data)
File "C:\Users\stem\Anaconda3\lib\site-packages\keras\engine\training.py", line 889, in train_step
y_pred = self(x, training=True)
File "C:\Users\stem\Anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\stem\Anaconda3\lib\site-packages\keras\engine\input_spec.py", line 264, in assert_input_compatibility
raise ValueError(f'Input {input_index} of layer "{layer_name}" is '
ValueError: Input 0 of layer "model" is incompatible with the layer: expected shape=(None, 512, 32), found shape=(None, 1, 32)
У вас не совпадают тензоры. Лайфхак: посмотрите в самый конец, там написана ошибка.
Обсуждают сегодня