亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 MNIST 深度神經網絡訓練 TensorFlow 2.0 上使用 model.fit 時出錯

在 MNIST 深度神經網絡訓練 TensorFlow 2.0 上使用 model.fit 時出錯

慕尼黑8549860 2022-12-20 11:25:39
我正在嘗試使用 MNIST 數據集訓練深度神經網絡,這是我的 jupyter notebook 的一些代碼:第一個塊工作正常:# Select the hyperparameter batch sizeBATCH_SIZE = 100# Batch the train, validatiion and test datatrain_data = train_data.batch(BATCH_SIZE)validation_data = validation_data.batch(num_validation_samples)test_data = test_data.batch(num_test_samples)# Transform the validation data into tuples for the inputs and targetsvalidation_inputs, validation_targets = next(iter(validation_data))# Defining model hyperparametersinput_size = 784output_size = 10hidden_layer_size = 50# Defining the modelmodel = tf.keras.Sequential([    tf.keras.layers.Flatten(input_shape=(28, 28, 1)),    tf.keras.layers.Dense(hidden_layer_size, activation='relu'),    tf.keras.layers.Dense(hidden_layer_size, activation='relu'),    tf.keras.layers.Dense(output_size, activation='softmax')])# Select the optimizer algorithm and the loss functionmodel.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
查看完整描述

1 回答

?
天涯盡頭無女友

TA貢獻1831條經驗 獲得超9個贊

我設法通過更改 tensoflow-datasets 模塊的版本解決了這個問題,我使用的是版本 3,然后回到版本 2.1,腳本就可以工作了。



查看完整回答
反對 回復 2022-12-20
  • 1 回答
  • 0 關注
  • 107 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號