使用回调函数报错

来源:2-6 实战回调函数

经不住的岁月如注似水流年

2019-06-07

File “D:/JetBrains/PycharmProjects/tensorflow2/tf_keras/classification_model_dnn.py”, line 61, in
callbacks=callbacks)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\keras\engine\training.py”, line 873, in fit
steps_name=‘steps_per_epoch’)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py”, line 363, in model_iteration
callbacks._call_batch_hook(mode, ‘end’, batch_index, batch_logs)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\keras\callbacks.py”, line 227, in _call_batch_hook
batch_hook(batch, logs)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\keras\callbacks.py”, line 509, in on_train_batch_end
self.on_batch_end(batch, logs=logs)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\keras\callbacks.py”, line 1277, in on_batch_end
self._log_trace()
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\keras\callbacks.py”, line 1308, in _log_trace
profiler_outdir=self.log_dir)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\ops\summary_ops_v2.py”, line 1144, in trace_export
_profiler.save(profiler_outdir, _profiler.stop())
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\eager\profiler.py”, line 122, in save
gfile.MakeDirs(plugin_dir)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\lib\io\file_io.py”, line 448, in recursive_create_dir
recursive_create_dir_v2(dirname)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\lib\io\file_io.py”, line 464, in recursive_create_dir_v2
pywrap_tensorflow.RecursivelyCreateDir(compat.as_bytes(path), status)
File “D:\Anaconda3\envs\tensorflow2\lib\site-packages\tensorflow\python\framework\errors_impl.py”, line 548, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: ./dnn-callbacks\plugins\profile\2019-06-07_21-42-27; No such file or directory

写回答

1回答

O_O_似水流年_O_O

2019-06-13

你这个问题是保存结果文件的文件夹目录没有创建,要么在代码里判断下不存在就创建,要么就在硬盘上先创建好

0
0

Google老师亲授 TensorFlow2.0 入门到进阶

Tensorflow2.0实战—以实战促理论的方式学习深度学习

1849 学习 · 896 问题

查看课程