{"id":6778,"date":"2020-01-25T13:02:04","date_gmt":"2020-01-25T04:02:04","guid":{"rendered":"https:\/\/www.stuffy.site\/wordpress\/?p=6778"},"modified":"2020-02-11T18:42:24","modified_gmt":"2020-02-11T09:42:24","slug":"tensorflow2-1-0-windows10","status":"publish","type":"post","link":"https:\/\/www.stuffy.site\/wordpress\/?p=6778","title":{"rendered":"TensorFlow2.1.0 \u74b0\u5883\u69cb\u7bc9(Windows10)"},"content":{"rendered":"\n<p>\u7a81\u7136\u3067\u3059\u304cAnaconda \u306b\u30c7\u30a3\u30fc\u30d7\u30e9\u30fc\u30cb\u30f3\u30b0\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u30fcTensorFlow \u74b0\u5883\u3092\u69cb\u7bc9\u3057\u305f\u3044\u3068\u601d\u3044\u3001Google\u5148\u751f\u306b\u8a0a\u3044\u305f\u3068\u3053\u308d<\/p>\n\n\n\n<p><a href=\"https:\/\/qiita.com\/jonpili\/items\/e5444c31fbd16f30725a\">\u521d\u5fc3\u8005\u304cGPU\u642d\u8f09Windows10\u306bPython + Anaconda + TensorFlow + Keras\u306e\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u3066\u307f\u305f[2018\/4\/28]<\/a><\/p>\n\n\n\n<p>\u4e0a\u8a18Tips \u304c\u898b\u3064\u304b\u3063\u305f\u306e\u3067\u8a66\u3057\u305f\u3053\u3068\u3092\u30e1\u30e2\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30a8\u30c7\u30a3\u30b7\u30e7\u30f3 Windows10 Pro<br>\u30d0\u30fc\u30b8\u30e7\u30f3\u30001903<br>\u30de\u30b6\u30fc\u30dc\u30fc\u30c9 Asrock Z370 Pro4<br>CPU\u3000\u3000\u3000\u3000Intel Core i7 8700K<br>\u30e1\u30e2\u30ea\u3000\u3000\u300016.0GB<br>GPU\u3000\u3000\u3000\u3000Nvidia Quadro P2000<br><\/p>\n\n\n\n<p>\u307e\u305a\u306f\u4e0b\u8a18\u624b\u9806\u306b\u3066Anaconda Prompt\u3092\u7ba1\u7406\u8005\u3068\u3057\u3066\u5b9f\u884c\u3057\u3066Anaconda\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3002\uff08\u53c2\u8003\uff1a<a href=\"https:\/\/qiita.com\/kerobot\/items\/917dc7027e15f5ff75ac\">Windows\u74b0\u5883\u3067\u306eAnaconda\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8<\/a>\uff09<\/p>\n\n\n<pre>Anaconda\u672c\u4f53\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3059\u308b\n&gt; conda update -n base conda\n\nAnaconda\u3059\u3079\u3066\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3059\u308b\n&gt; conda update --all\n\nAnaconda\u306ePython\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3059\u308b\n&gt; conda update python<br><br>Python\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u78ba\u8a8d<br>&gt; python --version<br>Python 3.7.6\n\n<\/pre>\n\n\n<p><\/p>\n\n\n\n<p>Microsoft Visual Studio 2019 Community \u7121\u6599\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<br><a href=\"https:\/\/visualstudio.microsoft.com\/ja\/downloads\/\">https:\/\/visualstudio.microsoft.com\/ja\/downloads\/<\/a><\/p>\n\n\n\n<p>\u304b\u3089C++ \u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-251.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"572\" src=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-251-1024x572.png\" alt=\"\" class=\"wp-image-6779\" srcset=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-251-1024x572.png 1024w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-251-300x167.png 300w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-251-768x429.png 768w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-251.png 1290w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>\u7d9a\u3044\u3066Nvidia CUDA toolkit10.1 \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br><a href=\"https:\/\/developer.nvidia.com\/cuda-toolkit-archive\">https:\/\/developer.nvidia.com\/cuda-toolkit-archive<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-252.png\"><img loading=\"lazy\" decoding=\"async\" width=\"594\" height=\"444\" src=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-252.png\" alt=\"\" class=\"wp-image-6780\" srcset=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-252.png 594w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-252-300x224.png 300w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><\/a><\/figure>\n\n\n\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u6700\u65b0\u306e10.2 \u3060\u3068dll\u30a8\u30e9\u30fc\u304c\u3067\u305f\u306e\u3067\u3001\u3072\u3068\u3064\u4e0b\u306e\u30b0\u30ec\u30fc\u30c9\u3067\u3088\u304b\u3063\u305f\u307f\u305f\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p> <a rel=\"noreferrer noopener\" href=\"https:\/\/developer.nvidia.com\/rdp\/cudnn-download\" target=\"_blank\">https:\/\/developer.nvidia.com\/rdp\/cudnn-download<\/a> \u304b\u3089  cuDNN v7.6.5  [November 5th, 2019] for CUDA 10.1\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u89e3\u51cd\u3057\u3066 <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-254-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"675\" src=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-254-1-1024x675.png\" alt=\"\" class=\"wp-image-6784\" srcset=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-254-1-1024x675.png 1024w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-254-1-300x198.png 300w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-254-1-768x506.png 768w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-254-1.png 1376w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>bin,include, lib \u5404\u30d5\u30a9\u30eb\u30c0\u3092 C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1 \u306b\u4e0a\u66f8\u304d\u30b3\u30d4\u30fc\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-253-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"614\" src=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-253-1-1024x614.png\" alt=\"\" class=\"wp-image-6783\" srcset=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-253-1-1024x614.png 1024w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-253-1-300x180.png 300w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-253-1-768x460.png 768w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-253-1.png 1058w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Anaconda Navigator \u306e[Environments]\u304b\u3089\u4eee\u60f3\u74b0\u5883\u3092[Create]\u3001tensorflow \u3068\u5165\u529b\u3057\u3066 [Create]<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"461\" height=\"248\" src=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-256.png\" alt=\"\" class=\"wp-image-6785\" srcset=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-256.png 461w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-256-300x161.png 300w\" sizes=\"auto, (max-width: 461px) 100vw, 461px\" \/><figcaption><br><\/figcaption><\/figure>\n\n\n\n<p>[Not Installed] \u304b\u3089anaconda \u95a2\u9023\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u691c\u7d22\u3057\u3066\u3001[Apply] \u3059\u308b\u3068\u4eee\u60f3\u74b0\u5883\u306banaconda \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5b8c\u4e86\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-255.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"555\" src=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-255-1024x555.png\" alt=\"\" class=\"wp-image-6786\" srcset=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-255-1024x555.png 1024w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-255-300x163.png 300w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-255-768x416.png 768w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-255-1536x832.png 1536w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-255.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Anaconda Prompt (tensorflow) \u3092\u30b9\u30bf\u30fc\u30c8\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u7ba1\u7406\u8005\u3068\u3057\u3066\u8d77\u52d5\u3057\u3066tensorflow-gpu, keras \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n\n\n\n<p>\u8ffd\u8a18\uff09Anaconda Navigator \u306eEnvironments \u304b\u3089GUI\u3067tensorflow\u95a2\u9023\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3082\u3067\u304d\u307e\u3059\u3051\u3069\u30d0\u30fc\u30b8\u30e7\u30f3\u9055\u3044\u3067\u30a8\u30e9\u30fc\u304c\u3067\u308b\u306e\u3067\u3059\u3079\u3066\u4fe1\u983c\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n\n\n<pre>&gt; pip install tensorflow-gpu\n&gt; pip install -U tensorflow keras<\/pre>\n<p>\u6700\u521d\u3001pip install keras \u3057\u305f\u306e\u3067\u3059\u304c\u3001AtrributeError \u304c\u51fa\u305f\u306e\u3067\u4e00\u65e6\u3001pip uninstall keras \u3057\u3066\u518d\u5ea6\u3001pip install -U \u30aa\u30d7\u30b7\u30e7\u30f3\u3059\u308b\u3068\u4e0a\u624b\u304f\u884c\u304d\u307e\u3057\u305f\u3002\uff08\u307e\u3050\u308c\u5f53\u305f\u308a\u3067\u3057\u3087\u3046\u304b\uff1f\uff09\u30b9\u30bf\u30fc\u30c8\u30e1\u30cb\u30e5\u30fc\u304b\u3089Jupyter Notebook (tensorflow)\u3092\u8d77\u52d5\u3057\u3066\u30d0\u30fc\u30b8\u30e7\u30f3\u78ba\u8a8d\u3002<\/p>\n<pre>pip list | find \"tensor\"<br>\ntensorboard                        2.1.0              \ntensorflow                         2.1.0              \ntensorflow-estimator               2.1.0              \ntensorflow-gpu                     2.1.0              \ntensorflow-gpu-estimator           2.1.0\n<br>import keras\nprint(keras.__version__)<br>\nUsing TensorFlow backend.\n2.3.1<\/pre>\n\n\n<p>\u3081\u3067\u305f\u304fUsing TensorFlow backend. \u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-258-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"917\" height=\"285\" src=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-258-2.png\" alt=\"\" class=\"wp-image-6789\" srcset=\"https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-258-2.png 917w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-258-2-300x93.png 300w, https:\/\/www.stuffy.site\/wordpress\/wp-content\/uploads\/2020\/01\/2020-01-258-2-768x239.png 768w\" sizes=\"auto, (max-width: 917px) 100vw, 917px\" \/><\/a><\/figure>\n\n\n\n<p>TensorFlow 2.x \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304b\u3089TensorFlow 1.x \u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u305f\u3044\u3068\u304d\u306f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import tensorflow.compat.v1 as tf\ntf.disable_v2_behavior()<\/pre>\n\n\n\n<p>\u3068\u3059\u308b\u3068\u30cf\u30c3\u30d4\u30fc\u306b\u306a\u308c\u308b\u3088\u3046\u3067\u3057\u305f\u3002\uff08\u4e0b\u8a18\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u8ee2\u8a18\uff09<\/p>\n\n\n<pre>import tensorflow.compat.v1 as tf\nimport numpy as np\n\ntf.disable_v2_behavior()\n# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3\nx_data = np.random.rand(100).astype(np.float32)\ny_data = x_data * 0.1 + 0.3\n\n# Try to find values for W and b that compute y_data = W * x_data + b\n# (We know that W should be 0.1 and b 0.3, but TensorFlow will\n# figure that out for us.)\nW = tf.Variable(tf.random.uniform([1], -1.0, 1.0))\nb = tf.Variable(tf.zeros([1]))\ny = W * x_data + b\n\n# Minimize the mean squared errors.\nloss = tf.reduce_mean(tf.square(y - y_data))\noptimizer = tf.train.GradientDescentOptimizer(0.5)\ntrain = optimizer.minimize(loss)\n\n# Before starting, initialize the variables.  We will 'run' this first.\ninit = tf.global_variables_initializer()\n\n# Launch the graph.\nsess = tf.Session()\nsess.run(init)\n\n# Fit the line.\nfor step in range(201):\n    sess.run(train)\n    if step % 20 == 0:\n        print(step, sess.run(W), sess.run(b))\n\n# Learns best fit is W: [0.1], b: [0.3]<\/pre>","protected":false},"excerpt":{"rendered":"<p>\u7a81\u7136\u3067\u3059\u304cAnaconda \u306b\u30c7\u30a3\u30fc\u30d7\u30e9\u30fc\u30cb\u30f3\u30b0\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u30fcTensorFlow \u74b0\u5883\u3092\u69cb\u7bc9\u3057\u305f\u3044\u3068\u601d\u3044\u3001Google\u5148\u751f\u306b\u8a0a\u3044\u305f\u3068\u3053\u308d \u521d\u5fc3\u8005\u304cGPU\u642d\u8f09Windows10\u306bPython + Anaconda + T &hellip; <a href=\"https:\/\/www.stuffy.site\/wordpress\/?p=6778\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">TensorFlow2.1.0 \u74b0\u5883\u69cb\u7bc9(Windows10)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98,104,44],"tags":[],"class_list":["post-6778","post","type-post","status-publish","format-standard","hentry","category-python","category-tensorflow","category-windows10"],"_links":{"self":[{"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6778"}],"version-history":[{"count":11,"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6778\/revisions"}],"predecessor-version":[{"id":6806,"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6778\/revisions\/6806"}],"wp:attachment":[{"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stuffy.site\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}