-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmod.lua
More file actions
39 lines (31 loc) · 676 Bytes
/
tmod.lua
File metadata and controls
39 lines (31 loc) · 676 Bytes
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
print("set default tensor type to float")
torch.setdefaulttensortype('torch.FloatTensor')
function loadObject(fname)
local file=torch.DiskFile(fname)
local objRd=file:readObject()
file:close()
return objRd
end
function loadTrain(fprefix,ifafix,tfafix,nfile)
local id={}
local td={}
for i=1,nfile do
table.insert(id,loadObject(fprefix..i..ifafix))
table.insert(td,loadObject(fprefix..i..tfafix))
end
return id,td
end
require "conf"
require "dloader"
require "nn"
require "rnn"
require "SeqBGRU"
require "vecLookup"
require "maskZerovecLookup"
require "designn"
tmod=getnn()
crit=getcrit()
inp=devin[1]
tar=devt[1]
rs=tmod:forward(inp)
crit:forward(rs,tar)