Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensorflow.python.framework.errors_impl.InvalidArgumentError: Specified a list with shape [32,3] from a tensor with shape [2,3] [[node model/lstm/TensorArrayUnstack/TensorListFromTensor (defined at /PycharmProjects/Latestcodeemma/venv/lib/python3.8/site-packages/kerashypetune/kerashypetune.py:206) ]] [Op:__inference_train_function_10478] #48236

Closed
thomultee opened this issue Apr 1, 2021 · 3 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author type:others issues not falling in bug, perfromance, support, build and install or feature

Comments

@thomultee
Copy link

We are writing a neural network for text analysis. To do this we want to perform a gridsearch for the hyperparameters. However, in our code we get the following error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Specified a list with shape [32,3] from a tensor with shape [2,3]
[[node model/lstm/TensorArrayUnstack/TensorListFromTensor (defined at PycharmProjects/venv/lib/python3.8/site-packages/kerashypetune/kerashypetune.py:206) ]] [Op:__inference_train_function_10478]

Function call stack:
train_function

This would indicate that some dimensions do not line up, however, all our dimensions of the data set are correct as we can fit the model correctly, but the grid search does not work.
The full error is:

Traceback (most recent call last):
File "/Users/Desktop/grid_search.py", line 141, in
kgs.search([X_pricing_train, X_reports_train], Y_train, validation_data=([X_pricing_test, X_reports_test], Y_test), callbacks=callback)
File "/Users/PycharmProjects/venv/lib/python3.8/site-packages/kerashypetune/kerashypetune.py", line 206, in search
model.fit(x = x,
File "/Users/PycharmProjects/venv/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 1100, in fit
tmp_logs = self.train_function(iterator)
File "/Users/PycharmProjects/venv/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 828, in call
result = self._call(*args, **kwds)
File "/Users/PycharmProjects/venv/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 855, in _call
return self._stateless_fn(*args, **kwds) # pylint: disable=not-callable
File "/Users/PycharmProjects/venv/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2942, in call
return graph_function._call_flat(
File "/Users/PycharmProjects/venv/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 1918, in _call_flat
return self._build_call_outputs(self._inference_function.call(
File "/Users/PycharmProjects//venv/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 555, in call
outputs = execute.execute(
File "/Users/PycharmProjects/venv/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Specified a list with shape [32,3] from a tensor with shape [2,3]
[[node model/lstm/TensorArrayUnstack/TensorListFromTensor (defined at /PycharmProjects/venv/lib/python3.8/site-packages/kerashypetune/kerashypetune.py:206) ]] [Op:__inference_train_function_10478]

Function call stack:
train_function

Does someone know how to solve this error or where it could potentially go wrong? In the form of what kind of dimensions might not line up?

The way we defined our grid search is the following:

kerasgridsearch = KerasGridSearch(hypermodel, param_grid, monitor = 'val_loss', greater_is_better=False, tuner_verbose=1)
callback = K.callbacks.EarlyStopping(monitor=monitor)
kerasgridsearcg.search([X_1_train, X_2_train], Y_train, validation_data=([X_1_test, X_2_test], Y_test), callbacks=callback)

@thomultee thomultee added the type:others issues not falling in bug, perfromance, support, build and install or feature label Apr 1, 2021
@rthadur
Copy link
Contributor

rthadur commented Apr 1, 2021

please check for a similar issue here , thank you

@Saduf2019 Saduf2019 self-assigned this Apr 6, 2021
@Saduf2019 Saduf2019 added the stat:awaiting response Status - Awaiting response from author label Apr 12, 2021
@Saduf2019
Copy link
Contributor

@thomultee
You may also refer to similar issues and let us know: link,link1, link2

@rthadur
Copy link
Contributor

rthadur commented Apr 18, 2021

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

@rthadur rthadur closed this as completed Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author type:others issues not falling in bug, perfromance, support, build and install or feature
Projects
None yet
Development

No branches or pull requests

3 participants