TypeError: 'int' object is not iterable - Why am I getting this?

1,660 views
Skip to first unread message

Loser

unread,
Oct 3, 2017, 5:53:08 AM10/3/17
to Keras-users
I was trying to test a network, but seem to get an annoying error, which I am not quite sure I understand. 


import keras
from keras.models import Sequential
from keras.optimizers import SGD
from keras.layers.core import Dense, Activation, Lambda, Reshape,Flatten
from keras.layers import Conv1D,Conv2D,MaxPooling2D, MaxPooling1D, Reshape
from keras.utils import np_utils
from keras.models import Model
from keras.layers import Input, Dense
from keras.layers import Dropout
from keras import backend as K
from keras.callbacks import ReduceLROnPlateau
from keras.callbacks import CSVLogger
from keras.callbacks import EarlyStopping
from keras.layers.merge import Concatenate
from keras.callbacks import ModelCheckpoint
import random
import numpy as np


window_height
= 8
filter_size
=window_height
pooling_size
= 28
stride_step
= 2


def fws():


    np
.random.seed(100)
    input
= Input(5,window_height,1)
    shared_conv
= Conv2D(filters = 1, kernel_size = (0,window_height,1))
    output
= shared_conv(input)
   
print output.shape


fws
()




Error message being: 


 
File "experiment.py", line 34, in <module>
   fws
()
 
File "experiment.py", line 29, in fws
   input
= Input(5,window_height,1)
 
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1426, in Input
   input_tensor
=tensor)
 
File "/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
   
return func(*args, **kwargs)
 
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1321, in __init__
   batch_input_shape
= tuple(batch_input_shape)
TypeError: 'int' object is not iterable


Why am I getting this error message?

Loser

unread,
Oct 3, 2017, 6:31:21 AM10/3/17
to Keras-users
Issue resolved problem being missing double parenthesis when defining the input shape. 
Reply all
Reply to author
Forward
0 new messages