forked from karpathy/convnetjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspeedtest.html
55 lines (43 loc) · 1.2 KB
/
speedtest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Simple speed test</title>
<meta name="description" content="">
<meta name="author" content="">
<script src="../build/convnet.js"></script>
<script>
function logEvent(str) {
console.log(str);
var d = document.createElement('div');
d.innerHTML = str;
document.getElementById('result').appendChild(d);
}
n = 0;
dtall = 0;
function runExample() {
var t0 = +new Date();
layer.forward(x);
//layer.backward();
var t1 = +new Date();
var diff = t1 - t0;
dtall += diff;
n++;
logEvent('ran example ' + n + ' in ' + diff + 'ms, estimated average = ' + (dtall / n).toFixed(3) + 'ms');
}
function start() {
// Conv Layer definition used in convnet benchmarks
opt = { in_sx:128, in_sy:128, in_depth:3, sx:11, filters:96, stride: 1, pad: 0};
layer = new convnetjs.ConvLayer(opt);
x = new convnetjs.Vol(128, 128, 3);
run1i = setInterval(runExample, 5); // start
}
</script>
</head>
<body>
<button onclick="start()">Convolution Test Start</button>
<button onclick="window.clearInterval(run1i);">Stop</button>
<div id="result"></div>
</body>
</html>