Tensor Flow

環境:

Core i7-7700HQ 定格2.80GHz

GTX1070 8GB

8GB DDR4 SO-DIMM

Win10 Home 64 bit

 

まずはインストー

Installing TensorFlow on Windows  |  TensorFlow

 

1. CUDA

Installation Guide Windows :: CUDA Toolkit Documentation

Patch2もインストール。

2.cuDNN

NVIDIA cuDNN | NVIDIA Developer

 

3. Anaconda

Download Anaconda Now! | Continuum

最新4.4をインストール 

Python3.6なのだが、環境を作るときにpython3.5を指定する。

 

4. Tensor Flow環境作成、インストー

Anaconda Prompt起動

C:> conda create -n tensorflow python=3.5
C:> activate tensorflow
# Install GPU version tensor flow
(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.1-cp35-cp35m-win_amd64.whl

 

5.Validate

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))

一行ずつ入力・・・

>>> import tensorflow as tf

エラー・・・

ImportError: No module named '_pywrap_tensorflow_internal'

 

検索・・・

windowsにネイティブサポートしたTensorflowを動かす - Qiita

なるほど、VS Redistributableが足りないらしい?

 

入れてみて、もう一度!

ちがうみたい。

Redistは、anacondaでインストール済みのようだ。

 

こっちの記事

CUDA - TensorFlow importエラーについて(74099)|teratail

 

cuDNN 6.0 -> 5.1にインストールしなおし。。。

ファイルを置き換え

>>> import tensorflow as tf

成功!

 

>>> sess = tf.Session()
2017-07-22 02:27:49.195206: W c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2017-07-22 02:27:49.195814: W c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-22 02:27:49.197318: W c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-22 02:27:49.197765: W c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-22 02:27:49.198217: W c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-22 02:27:49.198701: W c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-07-22 02:27:49.199164: W c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-22 02:27:49.199214: W c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
2017-07-22 02:27:50.630526: I c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\common_runtime\gpu\gpu_device.cc:940] Found device 0 with properties:
name: GeForce GTX 1070
major: 6 minor: 1 memoryClockRate (GHz) 1.645
pciBusID 0000:01:00.0
Total memory: 8.00GiB
Free memory: 6.67GiB
2017-07-22 02:27:50.630665: I c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\common_runtime\gpu\gpu_device.cc:961] DMA: 0
2017-07-22 02:27:50.631359: I c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0: Y
2017-07-22 02:27:50.631775: I c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\common_runtime\gpu\gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0)

 なんかいっぱいログが出た。

 

>>> print(sess.run(hello))
b'Hello, TensorFlow!'

 よし!なんとか完了。

とりあえずここまで。

次回は

Getting Started With TensorFlow  |  TensorFlow

にすすむ