Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to try to compile tensorflow under mac os

Shulou Source: shulou.com Published: 2022-06-01 09:02:51 09月29日 Update

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.

Tags: Compile try tool more version knowledge article process utility operating system branch that is work meeting article case environment see knowledge point system industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Apple Shulou Technology vpn Xiaomi