Skip to content

Commit

Permalink
adding a small speedtest
Browse files Browse the repository at this point in the history
  • Loading branch information
karpathy committed Sep 1, 2014
1 parent f8c8d4f commit 735db5d
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions demo/speedtest.html
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>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>



0 comments on commit 735db5d

Please sign in to comment.