Compare commits
3 commits
418e4344b6
...
9acfd0633e
Author | SHA1 | Date | |
---|---|---|---|
9acfd0633e | |||
65b18cc1f0 | |||
ae595b45e6 |
5 changed files with 61 additions and 16 deletions
|
@ -5,7 +5,8 @@
|
||||||
"main": "src/index.mjs",
|
"main": "src/index.mjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"No tests have been written yet.\"",
|
"test": "echo \"No tests have been written yet.\"",
|
||||||
"build": "node ./src/esbuild.mjs"
|
"build": "node ./src/esbuild.mjs",
|
||||||
|
"watch": "ES_MODE=\"watch\" node ./src/esbuild.mjs"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
14
samples/lstm 2.txt
Normal file
14
samples/lstm 2.txt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Model: "sequential"
|
||||||
|
_________________________________________________________________
|
||||||
|
Layer (type) Output Shape Param #
|
||||||
|
=================================================================
|
||||||
|
embedding (Embedding) (None, 500, 16) 160000
|
||||||
|
_________________________________________________________________
|
||||||
|
lstm (LSTM) (None, 32) 6272
|
||||||
|
_________________________________________________________________
|
||||||
|
dense (Dense) (None, 1) 33
|
||||||
|
=================================================================
|
||||||
|
Total params: 166,305
|
||||||
|
Trainable params: 166,305
|
||||||
|
Non-trainable params: 0
|
||||||
|
_________________________________________________________________
|
|
@ -13,7 +13,6 @@ function do_visualisation(el_in, el_out) {
|
||||||
console.log(summary);
|
console.log(summary);
|
||||||
|
|
||||||
const svg = make_graph(summary);
|
const svg = make_graph(summary);
|
||||||
console.log(svg);
|
|
||||||
|
|
||||||
const container = document.createElement("div");
|
const container = document.createElement("div");
|
||||||
container.innerHTML = svg;
|
container.innerHTML = svg;
|
||||||
|
|
|
@ -57,10 +57,8 @@ async function do_html() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
function make_context() {
|
||||||
"use strict";
|
return {
|
||||||
|
|
||||||
const result = await esbuild.build({
|
|
||||||
entryPoints: [
|
entryPoints: [
|
||||||
"./app.mjs",
|
"./app.mjs",
|
||||||
"./app.css",
|
"./app.css",
|
||||||
|
@ -79,10 +77,40 @@ async function do_html() {
|
||||||
".ttf": "file",
|
".ttf": "file",
|
||||||
},
|
},
|
||||||
external: ["fs", "path"],
|
external: ["fs", "path"],
|
||||||
});
|
plugins: [
|
||||||
if (result.errors.length > 0 || result.warnings.length > 0)
|
{
|
||||||
console.log(result);
|
name: "copy-html",
|
||||||
|
setup(build) {
|
||||||
|
build.onEnd(result => {
|
||||||
|
if (result.errors.length > 0 || result.warnings.length > 0)
|
||||||
|
console.log(result);
|
||||||
|
console.log(`${new Date().toISOString()} | Build complete`);
|
||||||
|
do_html();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
await do_html();
|
(async () => {
|
||||||
|
"use strict";
|
||||||
|
switch(process.env.ES_MODE ?? "build") {
|
||||||
|
case "build":
|
||||||
|
const result = await esbuild.build(make_context());
|
||||||
|
if (result.errors.length > 0 || result.warnings.length > 0)
|
||||||
|
console.log(result);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "watch":
|
||||||
|
const ctx = await esbuild.context(make_context());
|
||||||
|
await ctx.watch();
|
||||||
|
console.log(`>>> Watching for changes`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// await do_html();
|
||||||
// console.log(await esbuild.analyzeMetafile(result.metafile));
|
// console.log(await esbuild.analyzeMetafile(result.metafile));
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@ export default function parse_summary(text) {
|
||||||
const sep_output_shape = lines[2].search("Output Shape");
|
const sep_output_shape = lines[2].search("Output Shape");
|
||||||
const sep_param_hash = lines[2].search("Param #");
|
const sep_param_hash = lines[2].search("Param #");
|
||||||
const sep_connected_to = has_connected_to ? lines[2].search("Connected to") : lines[2].length;
|
const sep_connected_to = has_connected_to ? lines[2].search("Connected to") : lines[2].length;
|
||||||
|
console.log(`DEBUG:layers_raw`, layers_raw);
|
||||||
let layer_prev = null;
|
let layer_prev = null;
|
||||||
let acc = [];
|
let acc = [];
|
||||||
for (const line of layers_raw) {
|
for (const line of layers_raw) {
|
||||||
if(line.trim().length == 0) {
|
console.log(`DEBUG:layers/line`, line, `CONDITION B`, line.trim().search(/^\-+$/));
|
||||||
|
if(line.trim().length == 0 || line.trim().search(/^[-_]+$/) > -1) {
|
||||||
if(acc.length === 0) continue;
|
if(acc.length === 0) continue;
|
||||||
|
console.log(`LAYER`);
|
||||||
|
|
||||||
console.log(`DEBUG:params`, acc.map(layer_line => layer_line.substring(sep_param_hash, sep_connected_to).trim()));
|
console.log(`DEBUG:params`, acc.map(layer_line => layer_line.substring(sep_param_hash, sep_connected_to).trim()));
|
||||||
// Handle parsed item
|
// Handle parsed item
|
||||||
|
@ -39,7 +41,8 @@ export default function parse_summary(text) {
|
||||||
result.connected_to = [ layer_prev.name ];
|
result.connected_to = [ layer_prev.name ];
|
||||||
}
|
}
|
||||||
|
|
||||||
result.type = result.name_raw.match(/ \(([^)]+)\)/)[1];
|
console.log(`DEBUG:result`, result)
|
||||||
|
result.type = result.name_raw.match(/ \(([^)]+)(?:\)|$)/)[1];
|
||||||
result.name = result.name_raw.split(/\s+/)[0];
|
result.name = result.name_raw.split(/\s+/)[0];
|
||||||
|
|
||||||
layer_prev = result;
|
layer_prev = result;
|
||||||
|
@ -47,8 +50,8 @@ export default function parse_summary(text) {
|
||||||
|
|
||||||
acc.length = 0;
|
acc.length = 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
acc.push(line);
|
acc.push(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
const edges = [];
|
const edges = [];
|
||||||
|
|
Loading…
Reference in a new issue