Silly Typo😁
TypeError: __init__() takes from 1 to 3 positional arguments but 10 were given
The "TypeError" above is really a "TYPE" error (means TYPING , not data type😆😆)
I actually forgot to put a square brackets for array inside model.Sequential.
model = tf.keras.models.Sequential(
tf.keras.layers.Conv2D(16, 3, activation = "relu" , input_shape = (180,180,3)),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Conv2D(32, 3, activation = "relu"),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Conv2D(64, 3, activation = "relu"),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(512, activation = "relu"),
tf.keras.layers.Dense(5, activation = "softmax")
)
They all look like parameters rather than array of layers, isn't it ?
Below is the correct code:
model = tf.keras.models.Sequential([
tf.keras.layers.Conv2D(16, 3, activation = "relu" , input_shape = (180,180,3)),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Conv2D(32, 3, activation = "relu"),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Conv2D(64, 3, activation = "relu"),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(512, activation = "relu"),
tf.keras.layers.Dense(5, activation = "softmax")
])
The compiler does some pun when it says Type Error, I think😉
No comments:
Post a Comment