【发布时间】:2021-10-17 00:38:48
【问题描述】:
我在 Tensorflow 中有这个功能和标签:
>>> play_features.head()
enemy_class player_class player_cards enemy_cards previous_player_placed_card
0 [0, 0, 0] [0, 0, 0] [0, 6, 12, 17, 0, 6, 12, 17, 0, 6, 12, 17] [0, 6, 12, 17, 0, 6, 12, 17, 0, 6, 12, 17] [12, 12, 12]
1 [0, 0, 0] [0, 0, 0] [0, 6, 12, 17, 0, 6, 12, 17, 0, 6, 12, 17] [0, 6, 12, 17, 0, 6, 12, 17, 0, 6, 12, 17] [-1]
>>> play_label.head()
0 [6, 6, 6]
1 [6]
play_model = tf.keras.Sequential([layers.Dense(64), layers.Dense(1)])
play_model.compile(loss = tf.losses.MeanSquaredError(), optimizer = tf.optimizers.Adam())
play_model.fit(play_features.to_numpy(), play_label.to_numpy(), epochs=10)
鉴于我有这个错误,我怎么能把这个模型融入到 Tensorflow 中?
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray).
【问题讨论】:
标签: python tensorflow