Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to try to compile tensorflow under mac os

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about how to try to compile tensorflow under mac os, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Compilation environment and its tools

Compilation tool: bazel (https://bazel.build/versions/master/docs/bazel-overview.html)

Mac operating system version: 16.1.0 Darwin Kernel

Tensorflow version: github current master branch

Compilation operation process

Git clone https://github.com/tensorflow/tensorflow

Cd tensorflow

. / configure

GPU is not used in the configuration process

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 case

(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, TensorFlowers')

> > 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! The above is how to try to compile tensorflow under mac os. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report