<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Tensorflow on Jermineの博客 </title>
    <link>https://Jermine.vdo.pub/tags/tensorflow/</link>
    <description>Recent content in Tensorflow on Jermineの博客 </description>
    <generator>Hugo</generator>
    <language>zh-CN</language>
    <lastBuildDate>Wed, 05 Sep 2018 15:18:21 +0800</lastBuildDate>
    <atom:link href="https://Jermine.vdo.pub/tags/tensorflow/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>解决TensorFlow：ImportError: libcudnn.so.*: cannot open shared object file: No such file or dictionary</title>
      <link>https://Jermine.vdo.pub/deeplearn/tensorflow/%E8%A7%A3%E5%86%B3importerror_libcudnn.so.-cannot-open-shared-object-file/</link>
      <pubDate>Wed, 05 Sep 2018 15:18:21 +0800</pubDate>
      <guid>https://Jermine.vdo.pub/deeplearn/tensorflow/%E8%A7%A3%E5%86%B3importerror_libcudnn.so.-cannot-open-shared-object-file/</guid>
      <description>&lt;h3 id=&#34;环境&#34;&gt;环境&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Ubuntu16.04&#xA;Nvidia 384&#xA;CUDA 8.0&#xA;cuDNN 5&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;错误&#34;&gt;错误&lt;/h3&gt;&#xA;&lt;p&gt;TensorFlow、CUDA、cuDNN的版本关系我时常懵懵的，经常出现各种不支持的情况，比如今天安装了TensorFlow1.10.1，报错:&lt;code&gt;ImportError: libcudnn.so.7: cannot open shared object file: No such file or dictionary&lt;/code&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Windows下python3.7安装tensorflow1</title>
      <link>https://Jermine.vdo.pub/python/windows%E4%B8%8Bpython3.7%E5%AE%89%E8%A3%85tensorflow1.9/</link>
      <pubDate>Sun, 29 Jul 2018 17:49:08 +0800</pubDate>
      <guid>https://Jermine.vdo.pub/python/windows%E4%B8%8Bpython3.7%E5%AE%89%E8%A3%85tensorflow1.9/</guid>
      <description>&lt;h1 id=&#34;准备文件&#34;&gt;准备文件：&lt;/h1&gt;&#xA;&lt;p&gt;从&lt;a href=&#34;https://download.lfd.uci.edu/pythonlibs/o4uhg4xd/tensorflow-1.9.0-cp37-cp37m-win_amd64.whl&#34;&gt;这里下载windows的python3.7的tensorflow1.9安装包。&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;*注: &lt;a href=&#34;https://www.lfd.uci.edu/~gohlke/pythonlibs/&#34;&gt;这个网站&lt;/a&gt;的whl文件是非python官方的windows二进制扩展包。&lt;/p&gt;&#xA;&lt;h1 id=&#34;执行安装命令&#34;&gt;执行安装命令&lt;/h1&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PS C:\Users\Husee\Desktop&amp;gt; pip install .\tensorflow-1.9.0-cp37-cp37m-win_amd64.whl&#xA;Looking in indexes: http://mirrors.aliyun.com/pypi/simple&#xA;Processing c:\users\husee\desktop\tensorflow-1.9.0-cp37-cp37m-win_amd64.whl&#xA;Collecting termcolor&amp;gt;=1.1.0 (from tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz&#xA;Requirement already satisfied: setuptools&amp;lt;=39.1.0 in c:\users\husee\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.9.0) (39.0.1)&#xA;Collecting astor&amp;gt;=0.6.0 (from tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl&#xA;Collecting protobuf&amp;gt;=3.4.0 (from tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/77/78/a7f1ce761e2c738e209857175cd4f90a8562d1bde32868a8cd5290d58926/protobuf-3.6.1-py2.py3-none-any.whl (390kB)&#xA;    100% |████████████████████████████████| 399kB 12.8MB/s&#xA;Collecting grpcio&amp;gt;=1.8.6 (from tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/b1/0b/f46b579e65e11a1ddb0d2a19f458cac91ed71841fed39322e980fd58be44/grpcio-1.14.1-cp37-cp37m-win_amd64.whl (1.5MB)&#xA;    100% |████████████████████████████████| 1.5MB 13.7MB/s&#xA;Collecting absl-py&amp;gt;=0.1.6 (from tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/cc/e6/6cc5c834023685dd83a28bdb5c1826d9340111493a447e9a9230269defa8/absl-py-0.4.0.tar.gz (88kB)&#xA;    100% |████████████████████████████████| 92kB 13.1MB/s&#xA;Collecting tensorboard&amp;lt;1.10.0,&amp;gt;=1.9.0 (from tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/9e/1f/3da43860db614e294a034e42d4be5c8f7f0d2c75dc1c428c541116d8cdab/tensorboard-1.9.0-py3-none-any.whl (3.3MB)&#xA;    100% |████████████████████████████████| 3.3MB 25.7MB/s&#xA;Requirement already satisfied: wheel&amp;gt;=0.26 in c:\users\husee\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.9.0) (0.31.1)&#xA;Collecting numpy&amp;gt;=1.13.3 (from tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/90/ca/fac7871a7c7d78beb78d7d9562b8d5bfce9ff316dc6c2a7ac34927895609/numpy-1.15.1-cp37-none-win_amd64.whl (13.5MB)&#xA;    100% |████████████████████████████████| 13.5MB 12.6MB/s&#xA;Requirement already satisfied: six&amp;gt;=1.10.0 in c:\users\husee\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.9.0) (1.11.0)&#xA;Collecting gast&amp;gt;=0.2.0 (from tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz&#xA;Collecting werkzeug&amp;gt;=0.11.10 (from tensorboard&amp;lt;1.10.0,&amp;gt;=1.9.0-&amp;gt;tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)&#xA;    100% |████████████████████████████████| 327kB 34.2MB/s&#xA;Collecting markdown&amp;gt;=2.6.8 (from tensorboard&amp;lt;1.10.0,&amp;gt;=1.9.0-&amp;gt;tensorflow==1.9.0)&#xA;  Downloading http://mirrors.aliyun.com/pypi/packages/6d/7d/488b90f470b96531a3f5788cf12a93332f543dbab13c423a5e7ce96a0493/Markdown-2.6.11-py2.py3-none-any.whl (78kB)&#xA;    100% |████████████████████████████████| 81kB 4.8MB/s&#xA;Building wheels for collected packages: termcolor, absl-py, gast&#xA;  Running setup.py bdist_wheel for termcolor ... done&#xA;  Stored in directory: C:\Users\Husee\AppData\Local\pip\Cache\wheels\65\c8\98\8361afe9bafba434b7acf14c08627560d63018272226ff3e10&#xA;  Running setup.py bdist_wheel for absl-py ... done&#xA;  Stored in directory: C:\Users\Husee\AppData\Local\pip\Cache\wheels\50\6f\41\ae7dbb65f38f6e607b399117e4cb959977e016d12b6166a67f&#xA;  Running setup.py bdist_wheel for gast ... done&#xA;  Stored in directory: C:\Users\Husee\AppData\Local\pip\Cache\wheels\17\0a\dc\bb6d7b129029482a8d55901d66b65e756a681f6a1da7297a9b&#xA;Successfully built termcolor absl-py gast&#xA;Installing collected packages: termcolor, astor, protobuf, grpcio, absl-py, numpy, werkzeug, markdown, tensorboard, gast, tensorflow&#xA;Successfully installed absl-py-0.4.0 astor-0.7.1 gast-0.2.0 grpcio-1.14.1 markdown-2.6.11 numpy-1.15.1 protobuf-3.6.1 tensorboard-1.9.0 tensorflow-1.9.0 termcolor-1.1.0 werkzeug-0.14.1&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&#34;查看安装列表&#34;&gt;查看安装列表&lt;/h1&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PS C:\Users\Husee\Desktop&amp;gt; pip list&#xA;Package           Version&#xA;----------------- -------&#xA;absl-py           0.4.0&#xA;astor             0.7.1&#xA;astroid           1.6.5&#xA;colorama          0.3.9&#xA;gast              0.2.0&#xA;grpcio            1.14.1&#xA;isort             4.3.4&#xA;lazy-object-proxy 1.3.1&#xA;Markdown          2.6.11&#xA;mccabe            0.6.1&#xA;numpy             1.15.1&#xA;pip               18.0&#xA;protobuf          3.6.1&#xA;pylint            1.9.2&#xA;setuptools        39.0.1&#xA;six               1.11.0&#xA;tensorboard       1.9.0&#xA;tensorflow        1.9.0&#xA;termcolor         1.1.0&#xA;torch             0.4.1&#xA;Werkzeug          0.14.1&#xA;wheel             0.31.1&#xA;wrapt             1.10.11&#xA;PS C:\Users\Husee\Desktop&amp;gt; pip -V&#xA;pip 18.0 from c:\users\husee\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)&#xA;PS C:\Users\Husee\Desktop&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&#34;通过python调用tensorflow查看版本&#34;&gt;通过python调用tensorflow查看版本&lt;/h1&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;python&#xA;Python 3.7.0b5 (v3.7.0b5:abb8802389, May 31 2018, 01:54:01) [MSC v.1913 64 bit (AMD64)] on win32&#xA;Type &amp;#34;help&amp;#34;, &amp;#34;copyright&amp;#34;, &amp;#34;credits&amp;#34; or &amp;#34;license&amp;#34; for more information.&#xA;&amp;gt;&amp;gt;&amp;gt; import tensorflow as tf&#xA;Traceback (most recent call last):&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py&amp;#34;, line 58, in &amp;lt;module&amp;gt;&#xA;    from tensorflow.python.pywrap_tensorflow_internal import *&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py&amp;#34;, line 35, in &amp;lt;module&amp;gt;&#xA;    _pywrap_tensorflow_internal = swig_import_helper()&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py&amp;#34;, line 30, in swig_import_helper&#xA;    _mod = imp.load_module(&amp;#39;_pywrap_tensorflow_internal&amp;#39;, fp, pathname, description)&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\imp.py&amp;#34;, line 243, in load_module&#xA;    return load_dynamic(name, filename, file)&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\imp.py&amp;#34;, line 343, in load_dynamic&#xA;    return _load(spec)&#xA;ImportError: DLL load failed: 找不到指定的模块。&#xA;&#xA;During handling of the above exception, another exception occurred:&#xA;&#xA;Traceback (most recent call last):&#xA;  File &amp;#34;&amp;lt;stdin&amp;gt;&amp;#34;, line 1, in &amp;lt;module&amp;gt;&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py&amp;#34;, line 22, in &amp;lt;module&amp;gt;&#xA;    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py&amp;#34;, line 49, in &amp;lt;module&amp;gt;&#xA;    from tensorflow.python import pywrap_tensorflow&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py&amp;#34;, line 74, in &amp;lt;module&amp;gt;&#xA;    raise ImportError(msg)&#xA;ImportError: Traceback (most recent call last):&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py&amp;#34;, line 58, in &amp;lt;module&amp;gt;&#xA;    from tensorflow.python.pywrap_tensorflow_internal import *&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py&amp;#34;, line 35, in &amp;lt;module&amp;gt;&#xA;    _pywrap_tensorflow_internal = swig_import_helper()&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py&amp;#34;, line 30, in swig_import_helper&#xA;    _mod = imp.load_module(&amp;#39;_pywrap_tensorflow_internal&amp;#39;, fp, pathname, description)&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\imp.py&amp;#34;, line 243, in load_module&#xA;    return load_dynamic(name, filename, file)&#xA;  File &amp;#34;C:\Users\Husee\AppData\Local\Programs\Python\Python37\lib\imp.py&amp;#34;, line 343, in load_dynamic&#xA;    return _load(spec)&#xA;ImportError: DLL load failed: 找不到指定的模块。&#xA;&#xA;&#xA;Failed to load the native TensorFlow runtime.&#xA;&#xA;See https://www.tensorflow.org/install/install_sources#common_installation_problems&#xA;&#xA;for some common reasons and solutions.  Include the entire stack trace&#xA;above this error message when asking for help.&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;importerror-dll-load-failed找不到指定的模块-解决方案python&#34;&gt;ImportError： DLL load failed：找不到指定的模块 解决方案（Python）：&lt;/h3&gt;&#xA;&lt;p&gt;首先检查numpy、scipy、matplotlib、scikit-learn的版本是否更新到最新且符合当前Python版本： 如果出现不是最新的版本，先卸载该版本：（windows+&amp;quot;.&amp;quot;）pip uninstall numpy&#xA;再去http://www.lfd.uci.edu/~gohlke/pythonlibs/ 安装最新版本：（windows+&amp;quot;.&amp;quot;）pip install numpy&lt;/p&gt;</description>
    </item>
    <item>
      <title>Docker中使用深度学习框架并支持GPU加速</title>
      <link>https://Jermine.vdo.pub/docker/docker%E4%B8%AD%E4%BD%BF%E7%94%A8%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E6%A1%86%E6%9E%B6%E5%B9%B6%E6%94%AF%E6%8C%81gpu%E5%8A%A0%E9%80%9F/</link>
      <pubDate>Wed, 23 Aug 2017 15:40:16 +0800</pubDate>
      <guid>https://Jermine.vdo.pub/docker/docker%E4%B8%AD%E4%BD%BF%E7%94%A8%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E6%A1%86%E6%9E%B6%E5%B9%B6%E6%94%AF%E6%8C%81gpu%E5%8A%A0%E9%80%9F/</guid>
      <description>&lt;h2 id=&#34;docker中使用深度学习框架并支持gpu加速&#34;&gt;Docker中使用深度学习框架并支持GPU加速&lt;/h2&gt;&#xA;&lt;h3 id=&#34;启动一个支持gpu的容器&#34;&gt;启动一个支持gpu的容器&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker run --runtime=nvidia --restart=always --name tensorflow  -dit -v `pwd`:/app -w /app  nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;进入容器&#34;&gt;进入容器&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker exec -it tensorflow bash&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;设置源&#34;&gt;设置源&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&#xA;Jermine@ubuntu:~$ cat &amp;gt; /etc/apt/sources.list&#xA;&#xA;deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse&#xA;deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse&#xA;deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse&#xA;deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse&#xA;##测试版源&#xA;deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;更新源&#34;&gt;更新源&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo apt-get update &#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;安装相关依赖&#34;&gt;安装相关依赖&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# 导入环境变量&#xA; TENSORFLOW_VERSION=1.7.0 &#xA; &#xA; apt-get update -y  &amp;amp;&amp;amp; apt-get install -y --no-install-recommends python3 python3-pip  protobuf-compiler;\&#xA;    pip3 install --upgrade pip ;\&#xA;    python3 -V &amp;amp;&amp;amp; pip3 -V ;\&#xA;    pip3  --no-cache-dir install setuptools  ;\&#xA;    pip3 --no-cache-dir install  \&#xA;    https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-${TENSORFLOW_VERSION}-cp35-cp35m-linux_x86_64.whl ;\&#xA;    apt-get autoremove &amp;amp;&amp;amp; apt-get autoclean ;\&#xA;    rm -rf /var/lib/apt/lists/*&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;测试程序&#34;&gt;测试程序&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;import numpy as np&#xA;np.random.seed(0)&#xA;import tensorflow as tf&#xA;import time&#xA;&#xA;N,D = 6000,8000&#xA;&#xA;with tf.device(&amp;#39;/cpu:0&amp;#39;):&#xA;    x = tf.placeholder(tf.float32)&#xA;    y = tf.placeholder(tf.float32)&#xA;    z = tf.placeholder(tf.float32)&#xA;&#xA;    a = x * y&#xA;    b = a + z&#xA;    c = tf.reduce_sum(b)&#xA;&#xA;grad_x, grad_y, grad_z = tf.gradients(c, [x,y,z])&#xA;&#xA;start_time = time.time()&#xA;with tf.Session() as sess:&#xA;    values = {&#xA;        x: np.random.randn(N, D),&#xA;        y: np.random.randn(N, D),&#xA;        z: np.random.randn(N, D),&#xA;    }&#xA;    out = sess.run([c, grad_x, grad_y, grad_z],&#xA;                   feed_dict=values)&#xA;    c_val, grad_x_val, grad_y_val, grad_z_val = out&#xA;elapsed = time.time() - start_time&#xA;print(time.strftime(&amp;#34;%H:%M:%S&amp;#34;, time.gmtime(elapsed)))&#xA;print(&amp;#34;exit 0&amp;#34;)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;将其存为 test_gpu_for_tensorflow.py  ， 使用 &lt;code&gt;python3 test_gpu_for_tensorflow.py &lt;/code&gt; 执行结果如下：&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
