tensorflow常见bug总结

tensorflow常见错误汇总

1, ‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte

//当运行下面代码时
image_raw_data = tf.gfile.FastGFile(image_path).read()

utf-8不能对image_raw_data进行解码

//出现的错误
 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

解决方案:

//当运行下面代码时
image_raw_data = tf.gfile.FastGFile(image_path,'rb').read()

2,tensorflow:Error reported to Coordinator:

解决方案:

//做出如下修改
os.environ["CUDA_VISIBLE_DEVICES"] = '0' #指定GPU
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.5 # 最大分配比例
config.gpu_options.allow_growth = True #动态分配
sess = tf.Session(config = config)

你可能感兴趣的:(tensorflow常见bug总结)