Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.

本文详细记录了在Linux服务器上使用TensorFlow导入预训练模型时遇到的版本不匹配错误,并分享了解决方案,包括更新TensorFlow版本及正确卸载旧版本的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        在公司Linux服务器上执行tf.import_graph_def(graph_def, name='graph')导入训练好的图时,报了个错误:

ValueError: NodeDef mentions attr 'Truncate' not in Op<name=Cast; signature=x:SrcT -> y:DstT; attr=SrcT:ty
pe; attr=DstT:type>; NodeDef: graph/Cast = Cast[DstT=DT_FLOAT, SrcT=DT_UINT8, Truncate=false](graph/DecodeJpeg). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

       这个是说GraphDef-interpreting(序列图文件的解释器)与GraphDef-generating binary(序列图生成器)不匹配导致的,于是就将win下的TensorFlow版本从1.11.0(在该版本下生成的pb文件)升级到服务器一致的1.18.0(在该版本下执行的解释器),安装完TensorFlow1.18.0版本后,使用import TensorFlow as tf报错

     'tensorflow.python.training.checkpointable' has no attribute 'CheckpointableBase'

Google一番后,找到原因,原来是之前的1.11.0版本需要先卸载,才能再再安装1.18.0版本,搞定。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值