如何更新tensorflow以支持tf.contrib?

时间:2016-07-15 02:06:23

标签: machine-learning tensorflow deep-learning

我想在tf.contrib模块中使用初始值设定项和batch_norm,但我的程序说找不到它。我重新安装tensorflow仍然不能使用tf.contrib模块。谁能告诉我为什么?

1 个答案:

答案 0 :(得分:0)

我不知道你做了什么,但你肯定没有谷歌最新的Tensorflow版本。您应该按照this tutorial进行安装。

总结一下:

  1. 确保您拥有依赖项:sudo apt-get install python-pip python-dev
  2. 立即卸载您所拥有的任何内容:pip uninstall tensorflow
  3. 设置变量:
  4. 选择正确的:

    # Ubuntu/Linux 64-bit, CPU only, Python 2.7
    $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
    
    # Ubuntu/Linux 64-bit, GPU enabled, Python 2.7 
    # Requires CUDA toolkit 7.5 and CuDNN v4. For other versions, see "Install from sources" below.
    $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
    
    # Ubuntu/Linux 64-bit, CPU only, Python 3.4
    $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp34-cp34m-linux_x86_64.whl
    
    # Ubuntu/Linux 64-bit, GPU enabled, Python 3.4 
    # Requires CUDA toolkit 7.5 and CuDNN v4. For other versions, see "Install from sources" below.
    $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp34-cp34m-linux_x86_64.whl
    
    # Ubuntu/Linux 64-bit, CPU only, Python 3.5
    $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp35-cp35m-linux_x86_64.whl
    
    # Ubuntu/Linux 64-bit, GPU enabled, Python 3.5 
    # Requires CUDA toolkit 7.5 and CuDNN v4. For other versions, see "Install from sources" below.
    $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp35-cp35m-linux_x86_64.whl
    
    1. 安装
    2. 选择正确的:

      # Python 2
      $ sudo pip install --upgrade $TF_BINARY_URL
      
      # Python 3
      $ sudo pip3 install --upgrade $TF_BINARY_URL