-
Notifications
You must be signed in to change notification settings - Fork 60
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
RuntimeError: The layer has never been called and thus has no defined output shape. #32
Comments
Hi, do you mind sharing the TF and keras versions that you are using? Also, you could try to use an older version from around the time that the library was released. Cheers, |
i use TF v2.3.1 and keras v2.4.3. could you share your version of these ? |
It has been a long time since I tested the code and in general tensorflow 2 is not supported. You can also see issue #25 for more details. I would suggest TF 1.13.1 and keras 2.0.0 for testing purposes but you might even get it working with TF 2.1 and keras 2.3.1 . |
ok, thanks your answer and link. i tried to downgrade TF and others. i will reset all setting, restart on your suggestion version. |
Hi, if useful, I got an mnist example to almost work with: Still get an error though:
|
Alright, I finally got it to work! Specifically, /examples/mnist_mlp.py with With tensorflow 1.3.1, was not able to install the above-suggested keras 2.0.0 since "seqeval 0.0.12 requires Keras>=2.2.4, but you have keras 2.0.0 which is incompatible." |
when i run "python examples/mnist_cnn.py" according to "https://www.idiap.ch/~katharas/importance-sampling/examples/", but i have errors like below.
(cf, python examples/mnist_cnn.py --uniform, it is ok)
Do you have any idea to fix it?
==============================
Traceback (most recent call last):
File "examples/mnist_cnn.py", line 67, in
wrapped = ConstantTimeImportanceTraining(model)
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\training.py", line 444, in init
layer
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\training.py", line 340, in init
super(_UnbiasedImportanceTraining, self).init(model, score, layer)
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\training.py", line 39, in init
layer=layer
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\model_wrappers.py", line 169, in init
self._augment_model(model, score, reweighting)
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\model_wrappers.py", line 205, in _augment_model
output_shape = model.get_output_shape_at(0)[1:]
File "C:\Users\danie\anaconda3\envs\importance-sampling\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2030, in get_output_shape_at
'output shape')
File "C:\Users\danie\anaconda3\envs\importance-sampling\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2603, in _get_node_attribute_at_index
'and thus has no defined ' + attr_name + '.')
RuntimeError: The layer has never been called and thus has no defined output shape.
The text was updated successfully, but these errors were encountered: