-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTensorSaveLoad.lua
More file actions
50 lines (44 loc) · 1.05 KB
/
TensorSaveLoad.lua
File metadata and controls
50 lines (44 loc) · 1.05 KB
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
require 'torch'
require 'paths'
require 'gnuplot'
--obecne nacteni zdrojovych dat
--MyFolder = '/home/legomaniak/Dokumenty/site/Kostky/'
--TrainFileData = 'BB300P10F0000'
function NactiData(cesta)
if paths.filep(cesta) then
local file = torch.DiskFile(cesta,'r')
output = file:readObject()
file:close()
return output
end
end
function UlozData(cesta,data)
local file = torch.DiskFile(cesta,'w')
file:writeObject(data)
file:close()
end
function VytvorData(velikostX,velikostY,velikostZ)
x = torch.DoubleTensor(velikostX,velikostY,velikostZ)
i=0
x:apply(function()
i = i + 1
return i
end)
return x
end
function VytvorData(velikostX,velikostY)
x = torch.DoubleTensor(velikostX,velikostY)
i=0
x:apply(function()
i = i + 1
return i
end)
return x
end
--UlozData(MyFolder..TrainFileData..'2x3x4',VytvorData(2,3,4))
--UlozData(MyFolder..TrainFileData..'10x5x2',VytvorData(10,5,2))
--UlozData(MyFolder..TrainFileData..'5x10',VytvorData(5,10))
--a = NactiData(MyFolder..TrainFileData)
--print(a)
--velikosti = a:size()
--gnuplot.plot(a[1][1])