我試圖使用張量流線性分類器估計器預測未來的平均溫度。目標特征為 float64 類型,用于預測平均溫度的其他特征也是 float64。以下是我用于將特征轉換為tf數字列的方法。for feature_name in NUMERIC_COLUMNS: feature_columns.append(tf.feature_column.numeric_column( feature_name, dtype=tf.float64))我創建線性估計器,如下所示 feature_columns=feature_columns, n_classes=4)在訓練模型時,我得到以下錯誤。WARNING:tensorflow:Layer linear/linear_model is casting an input tensor fromdtype float64 to the layer's dtype of float32,which is new behavior in TensorFlow 2. The layer has dtype float32 because it's dtype defaults to floatx.Exception has occurred: ValueErrorLabels dtype should be integer. Instead got <dtype: 'float64'>.我正在努力理解為什么會考慮到我明確表示我希望所有功能都是float64類型。
Tensorflow 數據類型應為整數而不是 float64
ibeautiful
2022-09-06 21:11:44