You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Documentation/API.md
+6-9
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,7 @@ This document explains the basic API in __Bender__.
16
16
To create a network model you can create it from scratch or [import](Importing.md) it from a TensorFlow graph. We will explain how to create a network from scratch:
17
17
18
18
```swift
19
-
let network =Network(device: device,
20
-
inputSize: inputSize,
19
+
let network =Network(inputSize: inputSize,
21
20
parameterLoader: loader)
22
21
23
22
network.start
@@ -33,7 +32,7 @@ network.start
33
32
network.initialize()
34
33
```
35
34
36
-
First, we have to create the `network` which receives the MTLDevice (GPU), an inputSize and a parameter loader. The network comes with a `start` node which is the starting point of the network. The `inputSize` is the size expected by the first layer in the network. If the images you pass the network to be processed are not of the expected size then the `start` node will resize them accordingly.
35
+
First, we have to create the `network` which receives the inputSize and a parameter loader. The network comes with a `start` node which is the starting point of the network. The `inputSize` is the size expected by the first layer in the network. If the images you pass the network to be processed are not of the expected size then the `start` node will resize them accordingly.
37
36
38
37
The `parameterLoader` is responsible for loading the weights for each layer. It will be explained in detail further below.
39
38
@@ -54,16 +53,14 @@ After you finish adding layers to your network, you must call `network.initializ
To import a model saved in a [Protobuf](https://developers.google.com/protocol-buffers/) file you must add it to your Xcode project and load it like this:
`TFConverter` is the class responsible for converting a TF model to Bender. It will try to map nodes or groups of nodes in the TF graph to Bender layers. If it encounters unknown nodes then it will ignore them. This means that a graph might be disconnected if your TF model uses functions that are not implemented in Bender.
@@ -79,8 +75,7 @@ func optimize(graph: TFGraph)
79
75
After you create the optimizer, you have to add it to your `TFConverter` like this:
80
76
81
77
```swift
82
-
let converter = TFConverter.default()
83
-
converter.optimizers.append(MyTFOptimizer())
78
+
let converter = TFConverter.default(additionalOptimizers: [MyTFOptimizer()])
0 commit comments