loss=nan,val loss=nan
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
021-07-23 09:43:04.902503: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 59984/60000 [============================>.] - ETA: 0s - loss: nanWARNING:tensorflow:From D:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\keras\engine\training_v1.py:2048: Model.state_updates (from tensorflow.python.keras.engine.training) is deprecated and will be removed in a future version. Instructions for updating: This property should not be used in TensorFlow 2.0, as updates are applied automatically. 60000/60000 [==============================] - 156s 3ms/sample - loss: nan - val_loss: nan Epoch 2/10 60000/60000 [==============================] - 161s 3ms/sample - loss: nan - val_loss: nan
原代码:
vae = Model(input_img, y) vae.compile(optimizer='rmsprop', loss=None) vae.summary()
修改代码:
training = True if training: vae.compile(optimizer=tf.optimizers.RMSprop(lr=0.001, epsilon=1e-3), loss=None, experimental_run_tf_function = False) vae.summary() else: vae.compile(optimizer=tf.optimizers.RMSprop(lr=0.001, epsilon=1e-3), loss=None) vae.summary()
修改后运行效果:
欢迎关注我的CSDN博客心系五道口,有问题请私信2395856915@qq.com