I am trying to build a model with keras and tensorflow to play Go:
training_data = encode_from_file_info(training_files)
testing_data = encode_from_file_info(testing_files)
input_shape = (1, 19, 19)
model = Sequential(
[
keras.layers.Input(input_shape),
keras.layers.ZeroPadding2D(padding=3, data_format='channels_first'),
]
)
model.compile(
loss="categorical_crossentropy", optimizer="sgd", metrics=["accuracy"]
)
model.fit(
training_data, batch_size=64, epochs=15, verbose=1, validation_data=testing_data
)
I get the following error when I call model.fit():
Invalid input shape for input Tensor("Cast:0", shape=(None, 19, 19), dtype=float32). Expected shape (None, 1, 19, 19), but input has incompatible shape (None, 19, 19)
I have verified that the generators training_data and testing_data yield tuples of two ndarray with shape (1, 19, 19) and (361,).
I'm new to tensorflow and it is a black box to me. Obviously I'm missing something and making incorrect assumptions about my training data and the neural network. How do I troubleshoot issues like this? What tools are available to debug my model to find the shape mismatch?
model.fit().(batch_size, 1, 19, 19).