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

Exception: Layer timedistributeddense_1 requires to know the length of its input, but it could not be inferred automatically. #24

Open
andrenajp opened this issue Oct 6, 2016 · 7 comments

Comments

@andrenajp
Copy link

Using TensorFlow backend.
Loading training data
Finished loading training data
/usr/lib/python2.7/dist-packages/keras/layers/core.py:1112: UserWarning: TimeDistributedDense is deprecated, please use TimeDistributed(Dense(...)) instead.
warnings.warn('TimeDistributedDense is deprecated, '
Traceback (most recent call last):
File "train.py", line 27, in
model = network_utils.create_lstm_network(num_frequency_dimensions=freq_space_dims, num_hidden_dimensions=hidden_dims)
File "/home/andrena/Bureau/GRUV-master/nn_utils/network_utils.py", line 8, in create_lstm_network
model.add(TimeDistributedDense(input_dim=num_frequency_dimensions, output_dim=num_hidden_dimensions))
File "/usr/lib/python2.7/dist-packages/keras/models.py", line 276, in add
layer.create_input_layer(batch_input_shape, input_dtype)
File "/usr/lib/python2.7/dist-packages/keras/engine/topology.py", line 370, in create_input_layer
self(x)
File "/usr/lib/python2.7/dist-packages/keras/engine/topology.py", line 514, in call
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/usr/lib/python2.7/dist-packages/keras/engine/topology.py", line 572, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/usr/lib/python2.7/dist-packages/keras/engine/topology.py", line 149, in create_node
output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
File "/usr/lib/python2.7/dist-packages/keras/layers/core.py", line 1185, in call
' requires to know the length of its input, '
Exception: Layer timedistributeddense_1 requires to know the length of its input, but it could not be inferred automatically. Specify it manually by passing an input_shape argument to the first layer in your model.

@piteight
Copy link

Hi, I have the same error :(
dataset is 3 files, two of them are 1 hour long, and one have 3 minutes

@piteight
Copy link

My output:
Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
Loading training data
Finished loading training data
/home/basia/keras/keras/layers/core.py:1112: UserWarning: TimeDistributedDense is deprecated, please use TimeDistributed(Dense(...)) instead.
warnings.warn('TimeDistributedDense is deprecated, '
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties:
name: GeForce GTX 750
major: 5 minor: 0 memoryClockRate (GHz) 1.137
pciBusID 0000:01:00.0
Total memory: 1.95GiB
Free memory: 1.72GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 750, pci bus id: 0000:01:00.0)
Traceback (most recent call last):
File "train.py", line 27, in
model = network_utils.create_lstm_network(num_frequency_dimensions=freq_space_dims, num_hidden_dimensions=hidden_dims)
File "/media/basia/4e262056-f01f-4d05-a453-9e58b9a1a8da/GRUV/nn_utils/network_utils.py", line 8, in create_lstm_network
model.add(TimeDistributedDense(input_dim=num_frequency_dimensions, output_dim=num_hidden_dimensions))
File "/home/basia/keras/keras/models.py", line 276, in add
layer.create_input_layer(batch_input_shape, input_dtype)
File "/home/basia/keras/keras/engine/topology.py", line 370, in create_input_layer
self(x)
File "/home/basia/keras/keras/engine/topology.py", line 514, in call
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/home/basia/keras/keras/engine/topology.py", line 572, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/home/basia/keras/keras/engine/topology.py", line 149, in create_node
output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
File "/home/basia/keras/keras/layers/core.py", line 1185, in call
' requires to know the length of its input, '
Exception: Layer timedistributeddense_1 requires to know the length of its input, but it could not be inferred automatically. Specify it manually by passing an input_shape argument to the first layer in your model.

@piteight
Copy link

Solution is downgrading keras to version 0.1.0 . :)
Newest keras have some changes in naming and using timedistributedense and other stuff. I'm new to keras stuff, but i think it might be easily changed in nn_utils, where this network parameters are described.

@akgun1
Copy link

akgun1 commented Nov 1, 2016

I am setting up my system and currently having the same issue.
@piteight Are you using Theano or TensorFlow with keras version 0.1.0 ? I have TensorFlow installed but after doing the "sudo python setup.py install" I get an import error saying no module named keras.modules.

@piteight
Copy link

piteight commented Nov 3, 2016

Meybe this will work pip install https://github.com/fchollet/keras/tarball/0.1.0
Im using Theano, beacuse I read, that GRUV isnt compatibile with TensorFlow right now.

@akgun1
Copy link

akgun1 commented Nov 3, 2016

@piteight Thank you, it seems to be working now.

I uninstalled keras and re-installed using piteight's solution. Also, I switched Keras's backend from the default TensorFlow to Theano (instructions here: https://keras.io/backend/).

@mattpearson
Copy link

For those who want to use Keras version 1.1.1 (currently the latest, as of 11/12/16) then you can adopt the changes in my repo: https://github.com/mattpearson/GRUV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants