zoukankan      html  css  js  c++  java
  • 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 int32 for Tensor with dtype float32: 'Tensor("embedding_1/random_uniform:0", shape=(20000, 100), dtype=float32)'

    原来还有python版本的问题

    在服务器用的Python2.7训练的模型,在window上面Python2.7不支持TensorFlow

    因此在服务器上重新建立虚拟环境配置python3的环境重新训练模型最终加载训练好的模型成功

  • 相关阅读:
    AtomicReference与volatile的区别
    深度剖析ConcurrentHashMap(转)
    ConcurrentHashMap原理分析
    Java Stack源码分析
    Fail-Fast机制详解
    TreeSet源码分析
    状态(State)模式
    原型(Prototype)模式
    职责连模式
    观察者模式(Observer)
  • 原文地址:https://www.cnblogs.com/wlc297984368/p/7501955.html
Copyright © 2011-2022 走看看