Permalink
Browse files

Update code examples based on new `Tensor` initialization behavior.

  • Loading branch information...
dan-zheng committed May 11, 2018
1 parent e6e1514 commit fd250cbd86eac905c1ca75980694e44a2b196bde
Showing with 9 additions and 9 deletions.
  1. +2 −2 FAQ.md
  2. +1 −1 README.md
  3. +6 −6 Usage.md
  4. BIN docs/images/Usage-Playground.png
View
4 FAQ.md
@@ -57,7 +57,7 @@ in particular about [host-graph communication](https://github.com/tensorflow/swi
```swift
import TensorFlow
var x = Tensor([[1, 2], [3, 4]])
var x = Tensor<Float>([[1, 2], [3, 4]])
print(x)
x = x + 1
```
@@ -71,7 +71,7 @@ To work around the generated "send" for this particular example, you can reorder
```swift
import TensorFlow
var x = Tensor([[1, 2], [3, 4]])
var x = Tensor<Float>([[1, 2], [3, 4]])
x = x + 1
print(x)
```
View
@@ -18,7 +18,7 @@ with the full performance of TensorFlow Sessions on CPU, GPU and
```swift
import TensorFlow
var x = Tensor([[1, 2], [3, 4]])
var x = Tensor<Float>([[1, 2], [3, 4]])
for i in 1...5 {
x += x x
View
@@ -30,17 +30,17 @@ You can type Swift statements and the REPL will execute them immediately. Result
```
1> import TensorFlow
2> var x = Tensor([[1, 2], [3, 4]])
x: TensorFlow.Tensor<Double> = [[1.0, 2.0], [3.0, 4.0]]
2> var x = Tensor<Float>([[1, 2], [3, 4]])
x: TensorFlow.Tensor<Float> = [[1.0, 2.0], [3.0, 4.0]]
3> x + x
$R0: TensorFlow.Tensor<Double> = [[2.0, 4.0], [6.0, 8.0]]
$R0: TensorFlow.Tensor<Float> = [[2.0, 4.0], [6.0, 8.0]]
4> for _ in 0..<3 {
5. x += x
6. }
7> x
$R1: TensorFlow.Tensor<Double> = [[8.0, 16.0], [24.0, 32.0]]
$R1: TensorFlow.Tensor<Float> = [[8.0, 16.0], [24.0, 32.0]]
8> x[0] + x[1]
$R2: TensorFlow.Tensor<Double> = [32.0, 48.0]
$R2: TensorFlow.Tensor<Float> = [32.0, 48.0]
```
## Interpreter
@@ -131,7 +131,7 @@ To use Swift for TensorFlow with Xcode, you must have installed a toolchain from
```swift
import TensorFlow
let x = Tensor([[1, 2], [3, 4]])
let x = Tensor<Float>([[1, 2], [3, 4]])
print(x)
```
View
BIN +26.1 KB (130%) docs/images/Usage-Playground.png
Binary file not shown.

0 comments on commit fd250cb

Please sign in to comment.