1

我正在使用 GRU 架构处理多分类问题。它似乎有一个配置错误。请帮我调试模型。提前致谢。

在这里,我提供了模型:

# build the network
model = Sequential()

model=models.Sequential()
model.add(layers.GRU(1024,activation='tanh',input_shape=x_train.shape[1:], return_sequences=True))
model.add(layers.GRU(512,activation='tanh',return_sequences=True))
model.add(layers.Flatten())
model.add(layers.Dense(3,activation='sigmoid'))

model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])

results = model.fit(x_train, y_train, epochs = 150, batch_size=512,validation_data= (x_test, y_test))

这是我得到的错误:

InternalError:    Failed to call ThenRnnForward with model config: [rnn_mode, rnn_input_mode, rnn_direction_mode]: 3, 0, 0 , [num_layers, input_size, num_units, dir_count, max_seq_length, batch_size, cell_num_units]: [1, 1, 1024, 1, 16000, 512, 0] 
 [[{{node CudnnRNN}}]]
 [[sequential_1/gru/PartitionedCall]] [Op:__inference_train_function_5490]

Function call stack:
train_function -> train_function -> train_function
4

0 回答 0