LoginSignup
3
3

More than 3 years have passed since last update.

【Windows】Tensorflow2.0をビルドする(C++向け.dll)【備忘録】

Posted at

はじめに

基本的には公式マニュアル通り
Bazel C++ チュートリアルを見ながら、少し手を加えたところをメモとして残す

構成

  • Tensorflow 2.0.0
  • Python 3.6.8
  • Visual Studio 2017 Community
  • Bazel 0.26.1

ソースをダウンロード

git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout r2.0 ### ココ

.bazelrcを編集

tensorflowフォルダ直下にある.bazelrcファイルを編集

.bazelrc
startup --output_user_root=C:/tmp
build --enable_runfiles

ビルド

以下、開発者コマンドプロンプト for VS 2017で実行
Visual Studioが複数インストールされている場合は、コンパイラを明示しておく

set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC
set BAZEL_VC_FULL_VERSION=14.16.27023

BUILDファイルを内のコメントを参考に、必要そうなものをビルド

bazel build --config=opt //tensorflow:tensorflow_cc.dll # .dll生成
bazel build --config=opt //tensorflow:install_headers # includeフォルダ

dllの方はAMD Ryzen 5 3500U, 8GB RAMで65,000秒(=18時間)かかりました
end.png

おわり。

3
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3