在Windows上玩TensorFlow

TensorFlow is a machine learning library from Google. There are no Windows builds but I wanted to run it on Windows. There are some other blog posts that show people trying to get TensorFlow running on Windows with VMs or Docker (using a VM) but they are a little complex. This seems like a great chance to see of I can just run Bash on Windows 10, build TensorFlow and run it.

TensorFlow是Google的机器学习库。 没有Windows版本,但我想在Windows上运行。 还有一些其他博客文章显示了人们试图使TensorFlow在带有VM或Docker(使用VM)的Windows上运行,但有些复杂。 这似乎是一个绝佳的机会,我可以在Windows 10上运行Bash ,构建TensorFlow并运行它。

TensorFlow on Ubuntu on Windows 10

I'm running Windows 10 Insiders Build 14422 as of the time of this writing. I launched Bash on Windows and followed these pip (Python) instructions, just as if I was running Linux. Note that the GPU support won't work so I followed the CPU only instructions from my Surface Pro 3.

在撰写本文时,我正在运行Windows 10 Insiders Build 14422。 我在Windows上启动了Bash并遵循了这些pip(Python)指令,就像在运行Linux一样。 请注意,GPU支持不起作用,因此我遵循了Surface Pro 3中的仅CPU指令。

$ sudo apt-get install python-pip python-dev
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

It built, then I tested it like this:

它建成了,然后我像这样测试了它:


$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
>>>

Cool, but this is Hello World. Let's try the more complex example against the MINST Handwriting Models. The simple demo model for classifying handwritten digits from the MNIST dataset is in the sub-directorymodels/image/mnist/convolutional.py. You'll need to check when your mnist folder is.

很酷,但这是Hello World。 让我们针对MINST手写模型尝试更复杂的示例。 用于从MNIST数据集中对手写数字进行分类的简单演示模型位于子目录models/image/mnist/convolutional.py 。 您需要检查mnist文件夹的时间。

$ cd tensorflow/models/image/mnist
$ python convolutional.py
Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
Initialized!
Step 0 (epoch 0.00), 9.3 ms
Minibatch loss: 12.054, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
Step 100 (epoch 0.12), 826.7 ms
Minibatch loss: 3.289, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 7.0%
...

This set appears to be working great and is currently on Step 1500

这个装置似乎运作良好,目前位于步骤1500

There's bugs in the Bash on Windows 10, of course. It's in Beta. But it's not a toy, and it's gonna be a great addition to my developer toolbox. I like that I was able to follow the Linux instructions exactly and they just worked. I'm looking forward to seeing how hard I can push Ubuntu and Bash on Windows 10.

当然,Windows 10上的Bash中存在错误。 它是Beta版。 但这不是玩具,它将成为我开发人员工具箱的重要补充。 我喜欢我能够完全按照Linux的说明进行操作,并且它们可以正常工作。 我很期待看到我能在Windows 10上推动Ubuntu和Bash的努力程度。

Sponsor: Big thanks to SQL Prompt for sponsoring the feed this week! Have you got SQL fingers? TrySQL Prompt and you’ll be able to write, refactor, and reformat SQL effortlessly in SSMS and Visual Studio.Find out more.

赞助商:非常感谢SQL Prompt本周赞助了这个提要! 你有SQL手指吗? 尝试使用SQL Prompt ,您将可以在SSMS和Visual Studio中轻松编写,重构和重新格式化SQL。 了解更多

翻译自: https://www.hanselman.com/blog/playing-with-tensorflow-on-windows

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值