macos下如何尝试编译tensorflow

本篇文章给大家分享的是有关mac os下如何尝试编译 tensorflow,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

创新互联公司是一家专注于网站建设、成都网站设计与策划设计,皇姑网站建设哪家好?创新互联公司做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:皇姑等地区。皇姑做网站价格咨询:13518219792

编译环境及其工具

编译工具:bazel (https://bazel.build/versions/master/docs/bazel-overview.html)

mac 操作系统版本:16.1.0 Darwin Kernel

tensorflow 版本:github 当前master分支

编译操作过程

git clone https://github.com/tensorflow/tensorflow
cd tensorflow
./configure  
配置过程没有使用GPU

bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

sudo pip install /tmp/tensorflow_pkg/tensorflow-1.0.1-cp27-cp27m-macosx_10_12_intel.whl

hello world 案例

(dev-djdemo) ➜  dev-djdemo python
Python 2.7.10 (default, Jul 30 2016, 18:31:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
W 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.
W 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.
W 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.
W 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.
W 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.
>>> print(sess.run(hello))
Hello, TensorFlow!

以上就是mac os下如何尝试编译 tensorflow,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。


网站标题:macos下如何尝试编译tensorflow
链接分享:http://bzwzjz.com/article/jsepoj.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 定制网站设计 成都网站建设 宜宾网站设计 泸州网站建设 成都做网站建设公司 成都网站建设公司 成都网站制作 古蔺网站建设 企业网站建设 成都网站设计 成都网站设计公司 成都网站设计 网站设计公司 网站制作报价 网站建设 成都网站建设 外贸网站建设 企业网站制作 成都网站设计 成都网站建设 响应式网站建设 手机网站设计