-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Add demo about dataset 2. Add `prism` for code highlight 3. combine optimizers into a single file for loading efficiently
- Loading branch information
Showing
29 changed files
with
1,426 additions
and
505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* return output shape | ||
*/ | ||
function matmul(u_shape, v_shape) { | ||
u_shape = u_shape.slice(); | ||
v_shape = v_shape.slice(); | ||
u_shape.pop(); | ||
let tail = v_shape.pop(); | ||
v_shape.pop(); | ||
v_shape.push(tail); | ||
return u_shape.concat(v_shape); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { negative } from 'backend/ops.js'; | ||
import { fetch, loadFile2Global } from 'backend/symbols.js'; | ||
|
||
import { zip } from 'util/functools.js'; | ||
import { Tensor2CanvasWithImage } from 'visualize/image.js'; | ||
|
||
// import { xs2vectors, ys } from 'dataset/mnist_2000.js'; | ||
// var xs = xs2vectors().map(x => new Tensor([28, 28, 1], x)); | ||
// for (let i of xs) scale_shift(i, 2, -1); | ||
// store('mnist/x', ImageBuffer.fromTensors(xs)); | ||
// store('mnist/y', Int32Array.from(ys)); | ||
// saveGlobal("mnist2000.json", "mnist2000.raw"); | ||
|
||
var imgs, labels; | ||
|
||
function init() { | ||
return loadFile2Global('../../dataset/mnist2000.json', '../../dataset/mnist2000.raw').then(() => { | ||
imgs = fetch('mnist/x').tensors; | ||
labels = fetch('mnist/y'); | ||
|
||
return print; | ||
}); | ||
} | ||
|
||
|
||
function print(testbox) { | ||
for (let [img, label] of zip([imgs.slice(0, 700), labels.slice(0, 700)])) { | ||
let a = document.createElement('a'); | ||
d3.select(a).attr('data-position', 'top') | ||
.attr('data-delay', '50') | ||
.attr('data-tooltip', label) | ||
.classed('tooltipped', true).style('margin-left', '5px'); | ||
negative(img); | ||
let canvas = Tensor2CanvasWithImage(img); | ||
a.appendChild(canvas); | ||
testbox.appendChild(a); | ||
} | ||
|
||
} | ||
|
||
|
||
export { print, init }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<title>Dataset Demo</title> | ||
|
||
<script src="../../transpiler/system.js"></script> | ||
<script src="../sysconf.js"></script> | ||
|
||
<script src="../../visualize/jquery.min.js"></script> | ||
<script src="../../visualize/preload-mask.js"></script> | ||
|
||
<link rel="stylesheet" href="../../visualize/materialize/css/materialize.min.css" /> | ||
<link rel="stylesheet" href="../../visualize/materialize/css/material_icons.css" /> | ||
<script src="../../visualize/materialize/js/materialize.min.js"></script> | ||
|
||
|
||
<script src="../../visualize/d3.min.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class='row'> | ||
<div class='col s12'> | ||
<h1>Dataset Demo - MNIST</h1> | ||
<blockquote> | ||
This demo illustrated about | ||
</blockquote> | ||
</div> | ||
<div class='col s12' id="testbox"></div> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
<script type="text/javascript"> | ||
set_preload_mask(); | ||
var testbox = document.getElementById("testbox"); | ||
SystemJS.import('./demo.js').then(demo => demo.init()).then(print => { | ||
print(testbox); | ||
disable_preload_mask(); | ||
|
||
$('.tooltipped').tooltip({ | ||
delay: 50 | ||
}); | ||
}); | ||
// $(document).ready(function() { | ||
|
||
// }); | ||
</script> | ||
|
||
<script type="text/javascript" color="120,190,250" opacity="0.9" count="500" src="canvas-nest.min.js"></script> | ||
|
||
</html> |
Oops, something went wrong.