最近学习tensorflow与案例代码一致运行却不通过
Tensorflow2.1在创建TensorBoard callback时,日志输出文件采用./callbacks这种写法时间会报出tensorflow.python.eager.profiler.ProfilerNotRunningError: Cannot stop profiling. No profiler is running.
logdir = './callbacks' # 注意,这里有个bug,不能使用./callbacks这种形式表达,可能与tensorflow内部实现有关
if not os.path.exists(logdir):
os.mkdir(logdir)
output_model_file = os.path.join(logdir, "mnist_model.h5") # 定义输出的model文件,并放入logdir文件夹
callbacks = [
keras.callbacks.TensorBoard(logdir), #tensorboard出错
keras.callbacks.ModelCheckpoint(output_model_file, save_best_only=True),
keras.callbacks.EarlyStopping(patience=5, min_delta=1e-3)
]
当采用logdir = ”callbacks“这种不含有./这种windows寻找当前根目录写法时就可以顺利运行,可能是默认在当前根目录下吧
运行的非常顺利