帮我找出下面代码的错误loss_fn = tf.keras.losses.MeanSquaredError() metrics = [tf.k optimizer = tf.keras.optimizers.Adam(learning_rate=0.01) eras.metrics.MeanAbsoluteError(), tf.keras.metrics.RootMeanSquaredError()] model = GCNModel(hidden_dim=64, output_dim=32) model.compile(optimizer=optimizer, loss=loss_fn, metrics=metrics) history=model.fit((train_features,train_adj),train_labels,epochs=50,validation_data=((val_features, val_adj), val_labels)) test_scores = model.evaluate((test_features, test_adj), test_labels, verbose=0)
时间: 2023-06-04 21:07:02 浏览: 195
Mnist_keras.py.zip_keras_kerasmnist_py神经网络_神经网络_神经网络 keras
这段代码的错误在于第三行中的"tf.k",应该改为"tf.keras"。正确的是:
loss_fn = tf.keras.losses.MeanSquaredError()
metrics = [tf.keras.metrics.MeanAbsoluteError(), tf.keras.metrics.RootMeanSquaredError()]
optimizer = tf.keras.optimizers.Adam(learning_rate=0.01)
model = GCNModel(hidden_dim=64, output_dim=32)
model.compile(optimizer=optimizer, loss=loss_fn, metrics=metrics)
history=model.fit((train_features,train_adj),train_labels,epochs=50,validation_data=((val_features, val_adj), val_labels))
test_scores = model.evaluate((test_features, test_adj), test_labels, verbose=0)
阅读全文