I am very green behind the ears when it comes to creating a NN. Right now I am receiving the following error:
ValueError: Error when checking : expected dense_1_input to have 3 dimensions, but got array with shape (8, 8)
Background: I am using an 8x8 board this is how I am initializing it:
self.state = np.zeros((LENGTH, LENGTH))
Here is the code where I build my Model:
def build_model(self):
#builds the NN for Deep-Q Model
model = Sequential()
model.add(Dense(24,input_shape = (LENGTH, LENGTH), activation='relu'))
model.add(Flatten())
model.add(Dense(24, activation='relu'))
model.add(Dense(self.action_size, activation = 'linear'))
model.compile(loss='mse', optimizer='Adam')
return model
I figured since the shape of the board is (8,8) that the input_size should be the same. Not sure what I am doing wrong?
Just in case this is helpful:
The game I have made is super simple that involves 5 pieces on the board:
- player1 has 1 piece and can move forward and backward diagonally only 1 step
- player2 has 4 pieces and can only move forward from their position diagonally 1 step
The objective for player1 is to get to the other side of the board The objective for player2 is to trap player 1 so he cannot move
Any help would be greatly appreciated!