Skip to content

Commit

Permalink
update code examples for Functional Model
Browse files Browse the repository at this point in the history
  • Loading branch information
zchholmes committed Nov 24, 2018
1 parent 0a887f9 commit ae93517
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 41 deletions.
57 changes: 37 additions & 20 deletions html/docs/modelFunctional.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,9 @@

...
// necessary configurations
inputs: [input],
outputs: [addLayer],
outputsOrder: ["input", "conv1", "conv2", "conv3", "add"],
inputs: [ input ],
outputs: [ addLayer ],
outputsOrder: [ "conv1", "conv2", "conv3", "add" ],
layerShape: "rect",
layerInitStatus: "close",
stats: true
Expand All @@ -351,48 +351,65 @@
</div>

<div class="code-snippet">
<pre><code class="Javascript">let input = new TSP.layers.GreyscaleInput({
shape: [28, 28, 1]
});
<pre><code class="Javascript">let input = new TSP.layers.GreyscaleInput( {

shape: [ 28, 28, 1 ]

} );

let layer1 = new TSP.layers.Conv2d( {

let layer1 = new TSP.layers.Conv2d({
kernelSize: 2,
filters: 36,
strides: 1,
padding: "same"
});
padding: "same",
name: "conv1"

} );

layer1.apply( input );

let layer2 = new TSP.layers.Conv2d({
let layer2 = new TSP.layers.Conv2d( {

kernelSize: 2,
filters: 36,
strides: 1,
padding: "same"
});
padding: "same",
name: "conv2"

} );

layer2.apply( input );

let layer3 = new TSP.layers.Conv2d({
let layer3 = new TSP.layers.Conv2d( {

kernelSize: 2,
filters: 4,
strides: 1,
padding: "same"
});
padding: "same",
name: "conv3"

} );

layer3.apply( layer2 );

let addLayer = new TSP.layers.Add([layer1, layer3]);
let addLayer = new TSP.layers.Add(

[ layer1, layer3 ],

{ name: "add" }

);

let model = new TSP.model.Model(container, {

...
inputs: [input],
outputs: [addLayer],
outputsOrder: ["input", "conv1", "conv2", "conv3", "add"],
inputs: [ input ],
outputs: [ addLayer ],
outputsOrder: [ "conv1", "conv2", "conv3", "add" ],
...

});</code></pre>
} );</code></pre>
</div>

<div>
Expand Down
59 changes: 38 additions & 21 deletions html/docs/modelFunctional_zh.html
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@
<pre><code class="Javascript">let model = new TSP.model.Model( container, {

...
// necessary configurations
inputs: [input],
outputs: [addLayer],
outputsOrder: ["input", "conv1", "conv2", "conv3", "add"],
// 模型参数配置
inputs: [ input ],
outputs: [ addLayer ],
outputsOrder: [ "conv1", "conv2", "conv3", "add" ],
layerShape: "rect",
layerInitStatus: "close",
stats: true
Expand All @@ -350,48 +350,65 @@
</div>

<div class="code-snippet">
<pre><code class="Javascript">let input = new TSP.layers.GreyscaleInput({
shape: [28, 28, 1]
});
<pre><code class="Javascript">let input = new TSP.layers.GreyscaleInput( {

shape: [ 28, 28, 1 ]

} );

let layer1 = new TSP.layers.Conv2d( {

let layer1 = new TSP.layers.Conv2d({
kernelSize: 2,
filters: 36,
strides: 1,
padding: "same"
});
padding: "same",
name: "conv1"

} );

layer1.apply( input );

let layer2 = new TSP.layers.Conv2d({
let layer2 = new TSP.layers.Conv2d( {

kernelSize: 2,
filters: 36,
strides: 1,
padding: "same"
});
padding: "same",
name: "conv2"

} );

layer2.apply( input );

let layer3 = new TSP.layers.Conv2d({
let layer3 = new TSP.layers.Conv2d( {

kernelSize: 2,
filters: 4,
strides: 1,
padding: "same"
});
padding: "same",
name: "conv3"

} );

layer3.apply( layer2 );

let addLayer = new TSP.layers.Add([layer1, layer3]);
let addLayer = new TSP.layers.Add(

[ layer1, layer3 ],

{ name: "add" }

);

let model = new TSP.model.Model(container, {

...
inputs: [input],
outputs: [addLayer],
outputsOrder: ["input", "conv1", "conv2", "conv3", "add"],
inputs: [ input ],
outputs: [ addLayer ],
outputsOrder: [ "conv1", "conv2", "conv3", "add" ],
...

});</code></pre>
} );</code></pre>
</div>

<div>
Expand Down

0 comments on commit ae93517

Please # to comment.