keras 报错 ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("embedding_1/random_uniform:0", shape=(5001, 128), dtype=float32)'

在服务器上训练并保存模型,复制到本地之后load_model()报错:

ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: ‘Tensor("embedding_1/random_uniform:0", shape=(5001, 128), dtype=float32)‘

原因:服务器和本地的运行环境配置不同

查看本地keras版本:

In [1]: import keras
Using TensorFlow backend.

In [2]: keras.__version__
Out[2]: ‘2.0.6‘

(或者,用pip freeze列出所有包的版本信息)

而服务器上的keras版本是2.0.3

本地pip install 指定版本安装:

$ pip install Keras==2.0.3

keras 报错 ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("embedding_1/random_uniform:0", shape=(5001, 128), dtype=float32)'

时间: 2024-10-11 21:46:33

keras 报错 ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("embedding_1/random_uniform:0", shape=(5001, 128), dtype=float32)'的相关文章

Keras (Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("embedding_1/random_uniform:0", shape=(20000, 100), dtype=float32)')

这个问题出现根本原因是keras以及tensorflow的版本(服务器与本地)不一致 通过 Python import keras,tensorflow keras.__version__ tensorflow.__version__ 查看版本 然后通过 pip uninstall XXXX pip install install XXX版本号指定安装版本使得服务器与本机版本一致 本以为这个操作就可以解决问题结果依然还是Tensor conversion requested dtype int3

tensorflow models api:ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: 'Tensor("arg0:0", shape=(), dtype=float32, device=/device:CPU:0)'

tensorflow models api:ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: 'Tensor("arg0:0", shape=(), dtype=float32, device=/device:CPU:0)' 这个原因是你的tf-record有问题哈.检查pipline里面的tfrecord. tensorflow models api:ValueErr

matplotlib.pyplot import报错: ValueError: _getfullpathname: embedded null character in path

Environment: Windows 10, Anaconda 3.6 matplotlib 2.0 import matplotlib.pyplot 报错: ValueError: _getfullpathname: embedded null character in path 原因以及Solution: http://stackoverflow.com/questions/34004063/error-on-import-matplotlib-pyplot-on-anaconda3-f

tensorflow读取jpg格式图片报错 ValueError: Only know how to handle extensions: ['png']; with Pillow installed matplotlib can handle more images

当运行mpimg.imread("img.jpg")时,spyder 出现如下错误: ValueError: Only know how to handle extensions: ['png']; with Pillow installed matplotlib can handle more images 解决办法就是  安装pillow即可 我是在anaconde里安装的很简单,执行如下步骤即可: tensorflow读取jpg格式图片报错 ValueError: Only kn

报错:未能加载文件或程序集Microsoft.office.interop.excel,Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”HRESULT:0x80131040

报错:未能加载文件或程序集Microsoft.office.interop.excel,Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” 或它的某一个依赖项.找到的程序清单定义与程序集引用不匹配.异常来自HRESULT:0x80131040 WIN7环境.在装有2003的excel的XP导出成功 一直用office2010dll调试,不能导出excel 2003等旧版的. 把microsoft.office.C

重启Apache报错apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting的解决方法

启动apache提示 : apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName (1)

tensorflow-TFRecord报错ValueError: Protocol message Feature has no "feature" field.

编写代码用TFRecord数据结构存储数据集信息是报错:ValueError: Protocol message Feature has no "feature" field.或和这个错误非常类似的错误. 请检查 features=tf.train.Features(feature={...} 里面有没有单子写错.如果有一个单词写错都会报和上面类似的错误 原文地址:https://www.cnblogs.com/bestExpert/p/10546274.html

关于报错:django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None

线上项目转到测试,setting连接本地数据库报错. 1 django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None Python安装路劲下的Python36-32\Lib\site-packages\django\db\backends\mysql\base.py文件下. 注释下面语句 1 if version < (1, 3, 3): 2 r

git推送到github报错:error: The requested URL returned error: 403 Forbidden while accessing https://github.com

最近使用git命令从github克隆仓库到版本,然后进行提交到github时报错如下: [[email protected] git_test]# git push origin mastererror: The requested URL returned error: 403 Forbidden while accessing https://github.com/jsonhc/git_test.git/info/refs fatal: HTTP request failed 解决办法:参考