Skip to content

Commit 1c6ad35

Browse files
committed
Merging installation scripts.
1 parent 602f1ba commit 1c6ad35

File tree

8 files changed

+62
-66
lines changed

8 files changed

+62
-66
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The framework is Alpha testing now. Documents and examples are coming soon.
5454
### TensorFlow C API Library Installation
5555

5656
Perfect-TensorFlow is based on TensorFlow C API, i.e., `libtensorflow.so` on runtime.
57-
This project contains two express CPU v1.1.0 installation scripts for this module on both macOS / Ubuntu Linux, and will install the dynamic library into path `/usr/local/lib/libtensorflow.so`. You can download & run [`install.mac.sh`](https://github.com/PerfectlySoft/Perfect-TensorFlow/blob/master/install.mac.sh) for macOS X or [`install.linux.sh`](https://github.com/PerfectlySoft/Perfect-TensorFlow/blob/master/install.linux.sh).
57+
This project contains an express CPU v1.1.0 installation script for this module on both macOS / Ubuntu Linux, and will install the dynamic library into path `/usr/local/lib/libtensorflow.so`. You can download & run [`install.sh`](https://github.com/PerfectlySoft/Perfect-TensorFlow/blob/master/install.sh).
5858

5959
For more installation options, such as GPU/CPU and multiple versions on the same machine, please check TensorFlow website: [Installing TensorFlow for C](https://www.tensorflow.org/install/install_c)
6060

@@ -105,7 +105,7 @@ let tensor = try TF.Tensor.Scalar("Hello, Perfect TensorFlow! 🇨🇳🇨🇦")
105105

106106
// declare a new graph
107107
let g = try TF.Graph()
108-
108+
109109
// turn the tensor into an operation
110110
let op = try g.const(tensor: tensor, name: "hello")
111111

@@ -123,7 +123,7 @@ print(s2)
123123
### Matrix Operations
124124

125125

126-
As you can see, Swift version of TensorFlow keeps the same principals of the original one, i.e., create tensors, save tensors into graph, define the operations and then run the session & check the result.
126+
As you can see, Swift version of TensorFlow keeps the same principals of the original one, i.e., create tensors, save tensors into graph, define the operations and then run the session & check the result.
127127

128128
Here is an other simple example of matrix operations in Perfect TensorFlow:
129129

@@ -132,8 +132,8 @@ Here is an other simple example of matrix operations in Perfect TensorFlow:
132132
| 1 2 | |0 1| |0 1|
133133
| 3 4 | * |0 0| = |0 3|
134134
*/
135-
// input the matrix.
136-
// *NOTE* no matter how many dimensions a matrix may have,
135+
// input the matrix.
136+
// *NOTE* no matter how many dimensions a matrix may have,
137137
// the matrix should always input as an flattened array
138138
let srcA:[Float] = [[1, 2], [3, 4]].flatMap { $0 }
139139
let srcB:[Float] = [[0, 0], [1, 0]].flatMap { $0 }
@@ -170,12 +170,12 @@ let metaBuf = try TF.Buffer()
170170
// load the session
171171
let session = try g.load(
172172
exportDir: "/path/to/saved/model",
173-
tags: ["tag1", "tag2", ...],
173+
tags: ["tag1", "tag2", ...],
174174
metaGraphDef: metaBuf)
175175
```
176176

177177
A detailed example of loading model can be found in the [Perfect TensorFlow Testing Examples](https://github.com/PerfectlySoft/Perfect-TensorFlow/blob/master/Tests/PerfectTensorFlowTests/PerfectTensorFlowTests.swift#L349-L390).
178-
178+
179179
## Issues
180180

181181
We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.

README.zh_CN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
Perfect-TensorFlow 是基于其C语言函数库基础上的,简单说来就是您的计算机上在运行时必须安装 `libtensorflow.so`动态链接库。
5757

58-
本项目包含了两个用于快速安装该链接库 CPU v1.1.0版本的脚本,一个用于macOS而另外一个用于Ubuntu Linux。默认安装路径为`/usr/local/lib/libtensorflow.so`。您可以根据平台要求下载并运行 [`install.mac.sh`](https://github.com/PerfectlySoft/Perfect-TensorFlow/blob/master/install.mac.sh)[`install.linux.sh`](https://github.com/PerfectlySoft/Perfect-TensorFlow/blob/master/install.linux.sh).
58+
本项目包含了一个用于快速安装该链接库 CPU v1.1.0版本的脚本,默认安装路径为`/usr/local/lib/libtensorflow.so`。您可以根据平台要求下载并运行 [`install.sh`](https://github.com/PerfectlySoft/Perfect-TensorFlow/blob/master/install.sh)
5959

6060
更多的安装选项,如需要在同一台计算机上同时安装CPU/GPU或者多个不同版本,请参考官网网站: [Installing TensorFlow for C](https://www.tensorflow.org/install/install_c)
6161

@@ -105,7 +105,7 @@ let tensor = try TF.Tensor.Scalar("你好,Perfect TensorFlow! 🇨🇳🇨🇦
105105

106106
// 声明一个流程图
107107
let g = try TF.Graph()
108-
108+
109109
// 将张量节点加入流程图
110110
let op = try g.const(tensor: tensor, name: "hello")
111111

@@ -168,7 +168,7 @@ let metaBuf = try TF.Buffer()
168168
// 还原会话
169169
let session = try g.load(
170170
exportDir: "/path/to/saved/model",
171-
tags: ["tag1", "tag2", ...],
171+
tags: ["tag1", "tag2", ...],
172172
metaGraphDef: metaBuf)
173173
```
174174

Sources/PerfectTensorFlow/PerfectTensorFlow.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//
1717
//===----------------------------------------------------------------------===//
1818
//
19+
1920
import Foundation
2021
import TensorFlowAPI
2122

Sources/TensorFlowAPI/TensorFlowAPI.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
//
2-
// TensorFlowAPI.c
3-
// Perfect-TensorFlow
4-
//
5-
// Created by Rockford Wei on 2017-05-18.
6-
// Copyright © 2017 PerfectlySoft. All rights reserved.
7-
//
8-
//===----------------------------------------------------------------------===//
9-
//
10-
// This source file is part of the Perfect.org open source project
11-
//
12-
// Copyright (c) 2017 - 2018 PerfectlySoft Inc. and the Perfect project authors
13-
// Licensed under Apache License v2.0
14-
//
15-
// See http://perfect.org/licensing.html for license information
16-
//
17-
//===----------------------------------------------------------------------===//
18-
//
1+
//
2+
// TensorFlowAPI.c
3+
// Perfect-TensorFlow
4+
//
5+
// Created by Rockford Wei on 2017-05-18.
6+
// Copyright © 2017 PerfectlySoft. All rights reserved.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
//
10+
// This source file is part of the Perfect.org open source project
11+
//
12+
// Copyright (c) 2017 - 2018 PerfectlySoft Inc. and the Perfect project authors
13+
// Licensed under Apache License v2.0
14+
//
15+
// See http://perfect.org/licensing.html for license information
16+
//
17+
//===----------------------------------------------------------------------===//
18+
//
1919

2020
#include "TensorFlowAPI.h"
2121
#include <dlfcn.h>

Sources/TensorFlowAPI/include/TensorFlowAPI.h

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
//
2-
// TensorFlowAPI.h
3-
// Perfect-TensorFlow
4-
//
5-
// Created by Rockford Wei on 2017-05-18.
6-
// Copyright © 2017 PerfectlySoft. All rights reserved.
7-
//
8-
//===----------------------------------------------------------------------===//
9-
//
10-
// This source file is part of the Perfect.org open source project
11-
//
12-
// Copyright (c) 2017 - 2018 PerfectlySoft Inc. and the Perfect project authors
13-
// Licensed under Apache License v2.0
14-
//
15-
// See http://perfect.org/licensing.html for license information
16-
//
17-
//===----------------------------------------------------------------------===//
18-
//
1+
//
2+
// TensorFlowAPI.h
3+
// Perfect-TensorFlow
4+
//
5+
// Created by Rockford Wei on 2017-05-18.
6+
// Copyright © 2017 PerfectlySoft. All rights reserved.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
//
10+
// This source file is part of the Perfect.org open source project
11+
//
12+
// Copyright (c) 2017 - 2018 PerfectlySoft Inc. and the Perfect project authors
13+
// Licensed under Apache License v2.0
14+
//
15+
// See http://perfect.org/licensing.html for license information
16+
//
17+
//===----------------------------------------------------------------------===//
18+
//
19+
1920
#ifndef __TENSOR_FLOW_STRUCT__
2021
#define __TENSOR_FLOW_STRUCT__
2122
#include <stddef.h>

install.linux.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

install.mac.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

install.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
OSABR=$(echo $(uname)|tr '[:upper:]' '[:lower:]')
2+
DWN=/tmp/libtensorflow.tgz
3+
DIR=/tmp/libtf
4+
rm -rf $DIR
5+
mkdir $DIR
6+
rm -f $DWN
7+
URL=https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-$OSABR-x86_64-1.1.0.tar.gz
8+
echo $URL
9+
curl $URL -o $DWN
10+
tar xzf $DWN -C $DIR
11+
sudo cp $DIR/lib/libtensorflow.so /usr/local/lib
12+
rm -rf $DIR
13+
rm -f $DWN
14+
ls -l /usr/local/lib/libtensorflow.so

0 commit comments

Comments
 (0)