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
require 'image' | |
local memTestClass = torch.class('image.memTestClass') | |
function memTestClass:__newindex__(key, value) | |
if type(key) == 'number' then | |
return 1 -- do this so that rawset isn't called anyways, stupid of me to miss this | |
else rawset(self, key, value) end | |
end | |
function testMemory() | |
n = 50000 |
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
#!/usr/bin/env torch | |
require 'nn' | |
require 'image' | |
require 'xlua' | |
require 'pl' | |
opt = lapp[[ | |
-t,--threads (default 8) number of threads | |
-p,--type (default float) float or cuda |
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
local async = require 'async' | |
local http = require 'socket.http' | |
local ltn12 = require 'ltn12' | |
function start() | |
local url = 'tcp://localhost:8082/' | |
while true do | |
print(os.date()) | |
local response = {} |
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
local tcp = require 'socket' | |
require 'sys' | |
function start() | |
while true do | |
print(os.date()) | |
local conn = tcp.connect('localhost',8483) | |
conn:send('ealasjdiasldjeladj') | |
conn:close() | |
sys.sleep(0.01) |
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
features = nn.Sequential() | |
features:add(nn.Transpose({1,4},{1,3},{1,2})) | |
features:add(nn.SpatialConvolutionCUDA(fSize[1], fSize[2], 9, 9, 2, 2)) -- (111 - 9 + 2)/2 = 52 | |
features:add(nn.Threshold(0,1e-6)) | |
features:add(nn.SpatialMaxPoolingCUDA(2,2,2,2)) -- 26 | |
features:add(nn.SpatialConvolutionCUDA(fSize[2], fSize[3], 5, 5)) -- 22 | |
features:add(nn.Threshold(0,1e-6)) | |
features:add(nn.SpatialMaxPoolingCUDA(2,2,2,2)) -- 11 | |
features:add(nn.SpatialConvolutionCUDA(fSize[3], fSize[4], 4, 4)) -- 8 | |
features:add(nn.Threshold(0,1e-6)) |
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
require 'torch' | |
require 'nn' | |
local mytester = torch.Tester() | |
local precision = 1e-5 | |
local critest = {} | |
function critest.MSECriterion() |
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
require 'torch' | |
require 'nn' | |
torch.setdefaulttensortype('torch.FloatTensor') | |
frameSize = 4 -- each input frame has 4 numbers | |
hiddenSize = 5 -- each hidden layer has 5 units | |
outputSize = 1 -- each output layer has 1 output | |
-------------- Model ------------------------- | |
mlp = nn.Sequential() |
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
require 'torch' | |
require 'nn' | |
require 'sys' | |
torch.setdefaulttensortype('torch.FloatTensor') | |
numInputNodes=30 | |
numBatches=64 | |
numHidden1=64 | |
numHidden2=128 | |
numOutputNodes=1 |
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
dataset=torch.Tensor{ | |
{742313794,6385273,1362403386,80,169085576,0,1698277100,451,0}, | |
{742313860,6385273,1362403386,80,169085576,0,1698300945,452,0}, | |
{742338872,6385273,167840643,137,169085576,0,1718221933,480,0}, | |
{742338872,6385273,167926801,53,169085576,0,1718222057,471,0}, | |
{742338872,6385273,167846975,8014,169085576,0,1718222380,487,0}, | |
{742338872,641958438357784123396879472047392017641614042483,167846975,8014,169085576,0,1718222453,517,0}, | |
{742338934,6385273,167926801,53,169085576,0,1718273961,472,0}, | |
{742338934,641958438357784123396879472047392017641614042483,167846975,8014,169085576,0,1718275304,519,0}, | |
{742338934,6385273,167840643,137,169085576,0,1718275541,483,0}, |
OlderNewer