history = model.fit(train, epochs=100, validation_data = (test))
getting below error
InvalidArgumentError Traceback (most recent call last)
/tmp/ipykernel_785/1287905627.py in <cell line: 2>()
1 model train for 100 epochs
----> 2 history = model.fit(train, epochs=100, validation_data = (test))
/usr/local/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py in error_handler(*args, **kwargs)
68 # To get the full stack trace, call:
69 # tf.debugging.disable_traceback_filtering()
—> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
/usr/local/lib/python3.10/site-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
51 try:
52 ctx.ensure_initialized()
—> 53 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
54 inputs, attrs, num_outputs)
55 except core._NotOkStatusException as e:
InvalidArgumentError: Graph execution error:
Detected at node ‘gradient_tape/categorical_crossentropy/mul/BroadcastGradientArgs’ defined at (most recent call last):
File “/usr/local/lib/python3.10/runpy.py”, line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/local/lib/python3.10/runpy.py”, line 86, in _run_code
exec(code, run_globals)
File “/usr/local/lib/python3.10/site-packages/ipykernel_launcher.py”, line 17, in
app.launch_new_instance()
File “/usr/local/lib/python3.10/site-packages/traitlets/config/application.py”, line 1043, in launch_instance
app.start()
File “/usr/local/lib/python3.10/site-packages/ipykernel/kernelapp.py”, line 725, in start
self.io_loop.start()
File “/usr/local/lib/python3.10/site-packages/tornado/platform/asyncio.py”, line 215, in start
self.asyncio_loop.run_forever()
File “/usr/local/lib/python3.10/asyncio/base_events.py”, line 595, in run_forever
self._run_once()
File “/usr/local/lib/python3.10/asyncio/base_events.py”, line 1881, in _run_once
handle._run()
File “/usr/local/lib/python3.10/asyncio/events.py”, line 80, in _run
self._context.run(self._callback, *self._args)
File “/usr/local/lib/python3.10/site-packages/ipykernel/kernelbase.py”, line 513, in dispatch_queue
await self.process_one()
File “/usr/local/lib/python3.10/site-packages/ipykernel/kernelbase.py”, line 502, in process_one
await dispatch(*args)
File “/usr/local/lib/python3.10/site-packages/ipykernel/kernelbase.py”, line 409, in dispatch_shell
await result
File “/usr/local/lib/python3.10/site-packages/ipykernel/kernelbase.py”, line 729, in execute_request
reply_content = await reply_content
File “/usr/local/lib/python3.10/site-packages/ipykernel/ipkernel.py”, line 422, in do_execute
res = shell.run_cell(
File “/usr/local/lib/python3.10/site-packages/ipykernel/zmqshell.py”, line 540, in run_cell
return super().run_cell(*args, **kwargs)
File “/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py”, line 2975, in run_cell
result = self._run_cell(
File “/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py”, line 3030, in _run_cell
return runner(coro)
File “/usr/local/lib/python3.10/site-packages/IPython/core/async_helpers.py”, line 78, in pseudo_sync_runner
coro.send(None)
File “/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py”, line 3257, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File “/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py”, line 3473, in run_ast_nodes
if (await self.run_code(code, result, async=asy)):
File “/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py”, line 3553, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “/tmp/ipykernel_785/1287905627.py”, line 2, in <cell line: 2>
history = model.fit(train, epochs=100, validation_data = (test))
File “/usr/local/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py”, line 65, in error_handler
return fn(*args, **kwargs)
File “/usr/local/lib/python3.10/site-packages/keras/src/engine/training.py”, line 1742, in fit
tmp_logs = self.train_function(iterator)
File “/usr/local/lib/python3.10/site-packages/keras/src/engine/training.py”, line 1338, in train_function
return step_function(self, iterator)
File “/usr/local/lib/python3.10/site-packages/keras/src/engine/training.py”, line 1322, in step_function
outputs = model.distribute_strategy.run(run_step, args=(data,))
File “/usr/local/lib/python3.10/site-packages/keras/src/engine/training.py”, line 1303, in run_step
outputs = model.train_step(data)
File “/usr/local/lib/python3.10/site-packages/keras/src/engine/training.py”, line 1084, in train_step
self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
File “/usr/local/lib/python3.10/site-packages/keras/src/optimizers/optimizer.py”, line 543, in minimize
grads_and_vars = self.compute_gradients(loss, var_list, tape)
File “/usr/local/lib/python3.10/site-packages/keras/src/optimizers/optimizer.py”, line 276, in compute_gradients
grads = tape.gradient(loss, var_list)
Node: ‘gradient_tape/categorical_crossentropy/mul/BroadcastGradientArgs’
Incompatible shapes: [32,3] vs. [32,7688]
[[{{node gradient_tape/categorical_crossentropy/mul/BroadcastGradientArgs}}]] [Op:__inference_train_function_4776]