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(); |
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
| import torch | |
| import torchvision | |
| # An instance of your model. | |
| model = torchvision.models.resnet18(pretrained=True) | |
| # An example input you would normally provide to your model's forward() method. | |
| example = torch.rand(1, 3, 224, 224) | |
| # Use torch.jit.trace to generate a torch.jit.ScriptModule via tracing. |
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
| overlayed_model = OverlayNet(model) | |
| reduced_model = overlayed_model.generate(p=0.5) |
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
| const model = new ModelDescriptor({ | |
| modelId: 'QmZ9db8JzNCNrKuYyFN4Sv3a4Rn9CgZM99owJXwFjUhCik', | |
| modelPath: 'https://cloudflare-ipfs.com/ipfs/QmZ9db8JzNCNrKuYyFN4Sv3a4Rn9CgZM99owJXwFjUhCik', // resnet18 pytorch model | |
| modelType: 'torchjs/cuda' | |
| }); | |
| await node.initModel(model) | |
| node.inferModel(model, inputs).on('response', (outputs, confidences, finish) => { | |
| // Do something with the outputs, confidences | |
| // call finish() to finish the computation if outputs are already highly confidence | |
| }); |
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
| 0x66ed62338f125dfdf84c2d0b4ed69ea37283f2ea |
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
| 0x33bffb3b5a3c445789e92ff072c9821595df3872 |
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
| 0xF66b365bEeDF4a96A011Bd47205091e783437565 |
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
| BOOST_INC_DIR = [] | |
| BOOST_LIB_DIR = [] | |
| BOOST_COMPILER = 'gcc43' | |
| USE_SHIPPED_BOOST = True | |
| BOOST_PYTHON_LIBNAME = ['boost_python-py27'] | |
| BOOST_THREAD_LIBNAME = ['boost_thread'] | |
| CUDA_TRACE = False | |
| CUDA_ROOT = '/usr/local/cuda' | |
| CUDA_ENABLE_GL = False | |
| CUDA_ENABLE_CURAND = True |
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
| /* | |
| Usage: | |
| document.addEventListener("swipe", function(ev){ | |
| console.log("swipe: "+JSON.stringify(ev)); | |
| }); | |
| */ | |
| (function() { | |
| var CURRENT_TOUCH, EVENT, FIRST_TOUCH, GESTURE, HOLD_DELAY, TAPS, TOUCH_TIMEOUT, _angle, _capturePinch, _captureRotation, _cleanGesture, _distance, _fingersPosition, _getTouches, _hold, _isSwipe, _listenTouches, _onTouchEnd, _onTouchMove, _onTouchStart, _swipeDirection, _trigger; | |
| TAPS = null; |
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
| % LaTeX settings for MATLAB code listings | |
| % based on Ted Pavlic's settings in http://links.tedpavlic.com/ascii/homework_new_tex.ascii | |
| \usepackage{listings} | |
| \usepackage[usenames,dvipsnames]{color} | |
| % This is the color used for MATLAB comments below | |
| \definecolor{MyDarkGreen}{rgb}{0.0,0.4,0.0} | |
| % For faster processing, load Matlab syntax for listings | |
| \lstloadlanguages{Matlab}% |
NewerOlder