Skip to content

RuntimeError: The layer has never been called and thus has no defined output shape. #32

@jaesunghwang

Description

@jaesunghwang

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions