-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.lua
More file actions
41 lines (30 loc) · 820 Bytes
/
test.lua
File metadata and controls
41 lines (30 loc) · 820 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
40
41
-- <Nicolo' Savioli> --
require 'torch'
require 'nn'
require 'optim'
require 'xlua'
if opt.type == 'cuda' then
require 'cutorch'
require 'cunn'
require 'cudnn'
require 'fbcunn'
require 'fbnn'
end
local function validation()
print("---------- Testing: -----------")
result = optim.ConfusionMatrix(classes)
input = testData.data
input = input:cuda()
target = testData.labels
pred = model:forward(input)
if nGPUs > 1 then cutorch.synchronize() end
for i=1,testData:size() do
result:add(pred[i],target[i])
end
testAccuracy = result.totalValid * 100
print(result)
end -- END: local function validation()
local tm = torch.Timer()
validation()
print('Time took: ' .. tm:time().real)
print('Testing finish.')