Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Commit fd250cb

Browse files
committed
Update code examples based on new Tensor initialization behavior.
1 parent e6e1514 commit fd250cb

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

FAQ.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ in particular about [host-graph communication](https://github.com/tensorflow/swi
5757

5858
```swift
5959
import TensorFlow
60-
var x = Tensor([[1, 2], [3, 4]])
60+
var x = Tensor<Float>([[1, 2], [3, 4]])
6161
print(x)
6262
x = x + 1
6363
```
@@ -71,7 +71,7 @@ To work around the generated "send" for this particular example, you can reorder
7171

7272
```swift
7373
import TensorFlow
74-
var x = Tensor([[1, 2], [3, 4]])
74+
var x = Tensor<Float>([[1, 2], [3, 4]])
7575
x = x + 1
7676
print(x)
7777
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ with the full performance of TensorFlow Sessions on CPU, GPU and
1818
```swift
1919
import TensorFlow
2020

21-
var x = Tensor([[1, 2], [3, 4]])
21+
var x = Tensor<Float>([[1, 2], [3, 4]])
2222

2323
for i in 1...5 {
2424
x += x x

Usage.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ You can type Swift statements and the REPL will execute them immediately. Result
3030

3131
```
3232
1> import TensorFlow
33-
2> var x = Tensor([[1, 2], [3, 4]])
34-
x: TensorFlow.Tensor<Double> = [[1.0, 2.0], [3.0, 4.0]]
33+
2> var x = Tensor<Float>([[1, 2], [3, 4]])
34+
x: TensorFlow.Tensor<Float> = [[1.0, 2.0], [3.0, 4.0]]
3535
3> x + x
36-
$R0: TensorFlow.Tensor<Double> = [[2.0, 4.0], [6.0, 8.0]]
36+
$R0: TensorFlow.Tensor<Float> = [[2.0, 4.0], [6.0, 8.0]]
3737
4> for _ in 0..<3 {
3838
5. x += x
3939
6. }
4040
7> x
41-
$R1: TensorFlow.Tensor<Double> = [[8.0, 16.0], [24.0, 32.0]]
41+
$R1: TensorFlow.Tensor<Float> = [[8.0, 16.0], [24.0, 32.0]]
4242
8> x[0] + x[1]
43-
$R2: TensorFlow.Tensor<Double> = [32.0, 48.0]
43+
$R2: TensorFlow.Tensor<Float> = [32.0, 48.0]
4444
```
4545

4646
## Interpreter
@@ -131,7 +131,7 @@ To use Swift for TensorFlow with Xcode, you must have installed a toolchain from
131131
```swift
132132
import TensorFlow
133133

134-
let x = Tensor([[1, 2], [3, 4]])
134+
let x = Tensor<Float>([[1, 2], [3, 4]])
135135
print(x)
136136
```
137137

docs/images/Usage-Playground.png

26.1 KB
Loading

0 commit comments

Comments
 (0)