question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: __int__ returned non-int (type NoneType)

See original GitHub issue

After installing all requirements (python-midi and requirements.txt) I get this error message when executing generate.py:

Using TensorFlow backend.
Traceback (most recent call last):
  File "generate.py", line 153, in <module>
    main()
  File "generate.py", line 142, in main
    models = build_or_load()
  File "/Users/frederikriedel/Developer/DeepJ/util.py", line 15, in build_or_load
    models = build_models()
  File "/Users/frederikriedel/Developer/DeepJ/model.py", line 149, in build_models
    notes_out = naxis(time_out, chosen, style)
  File "/Users/frederikriedel/Developer/DeepJ/model.py", line 111, in f
    dense_layer_cache[l] = Dense(int(x.get_shape()[3]))
TypeError: __int__ returned non-int (type NoneType)

Do you maybe know what I’m missing here?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ashokrscommented, Dec 5, 2018

@calclavia @slave2sync @swarna-a-26 I am on Ubtuntu Linux with TF 1.12 with GPU (without GPU) and Keras 2.0. I am getting the same ValueError: Error when checking model input: expected input_1 to have 4 dimensions, but got array with shape (0, 1)

Any help would be much appreciated?

1reaction
swarna-a-26commented, Mar 14, 2018

@frogg @dannywu19910524 I used tensorflow1.6.0 and keras 2.0.0.That seems to remove the above error.Thanks so much. I am getting the below error when I try to train the data. volume_dense (Dense) multiple 129


concatenate_3 (Concatenate) (None, 128, 48, 3) 0

Total params: 1,269,476.0 Trainable params: 1,269,476.0 Non-trainable params: 0.0


Unable to load model from file. Loading data Training Traceback (most recent call last): File “train.py”, line 32, in <module> main() File “train.py”, line 16, in main train(models) File “train.py”, line 29, in train models[0].fit(train_data, train_labels, epochs=1000, callbacks=cbs, batch_size=BATCH_SIZE) File “/usr/local/lib/python3.6/site-packages/keras/engine/training.py”, line 1405, in fit batch_size=batch_size) File “/usr/local/lib/python3.6/site-packages/keras/engine/training.py”, line 1295, in _standardize_user_data exception_prefix=‘model input’) File “/usr/local/lib/python3.6/site-packages/keras/engine/training.py”, line 121, in _standardize_input_data str(array.shape)) ValueError: Error when checking model input: expected input_1 to have 4 dimensions, but got array with shape (0, 1)

Any idea about this error? I created a data folder and have three mid files there. Any thoughts to overcome this issue? Is this one also related to keras and tensorflow version? any thoughts will be helpful.I am using MAC 10.13.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

keras - __index__ returned non-int (type NoneType)
I was feeding a wrong array in model.fit. I found the error.
Read more >
TypeError can't multiply sequence by non-int of type 'float'
An error called "TypeError can't multiply sequence by non-int of type 'float'" will be raised. The easiest way to resolve this is by...
Read more >
TypeError: can't multiply sequence by non-int of type float ...
In this article, you will learn what the Python error TypeError: can't multiply sequence by non-int of type float means.
Read more >
TypeError: __int__ returned non-int (type NoneType)
这个说法是指你的输入shape跟要求的不符合静态和动态维度TensorFlow: Shapes and dynamic dimensions一文中,对张量的静态和动态维度做了描述。
Read more >
Can't Multiply Sequence by non-int of Type 'float' In Python?
[Solved] TypeError: Can't Multiply Sequence by non-int of Type 'float' In Python ... a float value by using the float() function that returns...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found