Skip to content

Commit

Permalink
Edit FAQ.md.
Browse files Browse the repository at this point in the history
- Edit broken issue link.
- Add short table of contents at the top.
  • Loading branch information
dan-zheng committed Apr 28, 2018
1 parent 4afa7ad commit 043e82c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

Please check here before posting a new issue.

### Why do I get ["error: array input is not a constant array of tensors"](https://github.com/tensorflow/swift/issues/10)?
* [Why do I get "error: array input is not a constant array of tensors"?](#why-do-i-get-error-array-input-is-not-a-constant-array-of-tensors)
* [Why do I get "error: internal error generating TensorFlow graph: GraphGen cannot lower a 'send/receive' to the host yet"](#why-do-i-get-error-internal-error-generating-tensorflow-graph-graphgen-cannot-lower-a-sendreceive-to-the-host-yet)
* [How can I use Python 3 with the Python module?](#how-can-i-use-python-3-with-the-python-module)

## Why do I get ["error: array input is not a constant array of tensors"](https://github.com/tensorflow/swift/issues/10)?

If you ran into this error, you likely wrote some code using `Tensor` without running Swift with optimizations (`-O`).

Expand All @@ -13,14 +17,14 @@ We're working on making `-O` not required, but in the meantime you need to speci
Here's how to enable optimizations in different environments:

* REPL: No need to add extra flags. Optimizations are on by default.
* Interpter: `swift -O main.swift`
* Interpreter: `swift -O main.swift`
* Compiler: `swiftc -O main.swift`
* `swift build`: `swift build -Xswiftc -O`
* Xcode: Go to `Build Settings > Swift Compiler > Code Generation > Optimization Level` and select `Optimize for Speed [-O]`.
* You may also need to add `libtensorflow.so` and `libtensorflow_framework.so` to `Linked Frameworks and Libraries` and change `Runtime Search Paths`.
See [this comment](https://github.com/tensorflow/swift/issues/10#issuecomment-385167803) for specific instructions with screenshots.

### Why do I get ["error: internal error generating TensorFlow graph: GraphGen cannot lower a 'send/receive' to the host yet"](https://github.com/tensorflow/swift/issues/8)?
## Why do I get ["error: internal error generating TensorFlow graph: GraphGen cannot lower a 'send/receive' to the host yet"](https://github.com/tensorflow/swift/issues/8)?

This error is related to the [graph program extraction algorithm](https://github.com/tensorflow/swift/blob/master/docs/GraphProgramExtraction.md), specifically
[host-graph communication](https://github.com/tensorflow/swift/blob/master/docs/GraphProgramExtraction.md#adding-hostgraph-communication).
Expand Down Expand Up @@ -51,7 +55,7 @@ Send/receive aren't fully implemented, which explains why you got your error.
The core team is working on it as a high-priority feature.
Once send/receive are done, your error should go away!

To work around the generated "send" for this example, you can reorder the code:
To work around the generated "send" for this particular example, you can reorder the code:

```swift
import TensorFlow
Expand All @@ -60,10 +64,10 @@ let y = x + 1
print(x)
```

The `Tensor` code is no longer "interrupted" by host code so there's no need for "send"!
The `Tensor` code is no longer "interrupted" by host code so there's no need for "send".

### How can I use Python 3 with the `Python` module?
## How can I use Python 3 with the `Python` module?

Currently, Swift is hard-coded to use Python 2.7.
Adding proper Python 3 support is non-trivial but in discussion.
See issue #13 for more information.
See [this issue](https://github.com/tensorflow/swift/issues/13) for more information.

0 comments on commit 043e82c

Please sign in to comment.