1. restore from checkpoint
1.1 tensorflow.python.framework.errors_impl.InternalError: Unable to get element from the feed as bytes 此处表明文件目录不对
1.2 export model 时出现:NotFoundError (see above for traceback): Key Modeffl/eval_net/l1/b1 not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
在新建模型的时候在前面加上了name_scape和variable_scope,导致检查点文件里参数的名称和新建模型的名称不一致,故而不可恢复,因为在检查点文件中找不到对应的参数名称
故而,如果在train模型时前面加上了相应的name_scope或者variable_scope,那么在导出时候也要加上,以此保证参数名称的一致性
2. serving
2.1 Invalid argument: Shape [?,62] is not fully defined
找到一个解决方案,但是不适合我,我用的是官网的方法
https://stackoverflow.com/questions/41346058/you-must-feed-a-value-for-placeholder-tensor-input-example-tensor-with-dtype-s
我遇到这个问题是在export,serving和client的过程中.
花了整整一天 ,终于知道是什么错了.
原因是在模型中我们用的是placeholder为了接收输入的组件,在export的时候,我们存储模型的参数和规定模型的输入和输出.但是由于模型中的placeholder实际上并没有与export的输入产生关联,故而出错.所以会一直报shape[?,62] is not fully defined.
要解决这个问题.就需要知道如何讲s与export的inputs产生关联
发现是这个问题后,就很好解决了.
(1).当模型的输入是作为参数时,在外部定义placeholder,然后指定模型参数为placeholder的值,关联了模型的输入与export定义的输入
(2).当模型的输入是placeholder时,就需要直接将input指定为model.[输入placeholder名就行了]
其实就是自己定义了placeholder的输入,模型里面计算的并不是用的这个placeholder输入
回复删除