Created
November 6, 2018 22:29
-
-
Save steerapi/a34e234a2604bf6155a9e0e2d72ac00d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var torchjs = require('@idn/torchjs'); | |
var script_module = new torchjs.ScriptModule('resnet18.pt'); | |
var tensor = torchjs.ones([1, 3, 224, 224], false); | |
const { performance } = require('perf_hooks'); | |
// Comment this out if you don't have cuda | |
script_module.cuda(); | |
let start, end; | |
start = performance.now(); | |
let otensor = script_module.forward(tensor); | |
end = performance.now(); | |
console.log(` gpu: ${end - start} ms`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment