@@ -5,10 +5,10 @@ function Sequential:profile()
5
5
function Sequential :updateOutput (input )
6
6
local currentOutput = input
7
7
for i = 1 ,# self .modules do
8
- local start = sys . clock ()
8
+ local start = torch . Timer ()
9
9
currentOutput = self .modules [i ]:updateOutput (currentOutput )
10
10
if cutorch then cutorch .synchronize () end
11
- print (torch .type (self .modules [i ]).. ' updateOutput: ' .. sys . clock () - start .. " s" )
11
+ print (torch .type (self .modules [i ]).. ' updateOutput: ' .. start : time (). real .. " s" )
12
12
end
13
13
self .output = currentOutput
14
14
return currentOutput
@@ -19,16 +19,16 @@ function Sequential:profile()
19
19
local currentModule = self .modules [# self .modules ]
20
20
for i =# self .modules - 1 ,1 ,- 1 do
21
21
local previousModule = self .modules [i ]
22
- local start = sys . clock ()
22
+ local start = torch . Timer ()
23
23
currentGradOutput = currentModule :updateGradInput (previousModule .output , currentGradOutput )
24
24
if cutorch then cutorch .synchronize () end
25
- print (torch .type (currentModule ).. ' updateGradInput: ' .. sys . clock () - start .. " s" )
25
+ print (torch .type (currentModule ).. ' updateGradInput: ' .. start : time (). real .. " s" )
26
26
currentModule = previousModule
27
27
end
28
- local start = sys . clock ()
28
+ local start = torch . Timer ()
29
29
currentGradOutput = currentModule :updateGradInput (input , currentGradOutput )
30
30
if cutorch then cutorch .synchronize () end
31
- print (torch .type (currentModule ).. ' updateGradInput: ' .. sys . clock () - start .. " s" )
31
+ print (torch .type (currentModule ).. ' updateGradInput: ' .. start : time (). real .. " s" )
32
32
self .gradInput = currentGradOutput
33
33
return currentGradOutput
34
34
end
@@ -40,18 +40,18 @@ function Sequential:profile()
40
40
local currentModule = self .modules [# self .modules ]
41
41
for i =# self .modules - 1 ,1 ,- 1 do
42
42
local previousModule = self .modules [i ]
43
- local start = sys . clock ()
43
+ local start = torch . Timer ()
44
44
currentModule :accGradParameters (previousModule .output , currentGradOutput , scale )
45
45
if cutorch then cutorch .synchronize () end
46
- print (torch .type (currentModule ).. ' accGradParameters: ' .. sys . clock () - start .. " s" )
46
+ print (torch .type (currentModule ).. ' accGradParameters: ' .. start : time (). real .. " s" )
47
47
currentGradOutput = currentModule .gradInput
48
48
currentModule = previousModule
49
49
end
50
50
51
- local start = sys . clock ()
51
+ local start = torch . Timer ()
52
52
currentModule :accGradParameters (input , currentGradOutput , scale )
53
53
if cutorch then cutorch .synchronize () end
54
- print (torch .type (currentModule ).. ' accGradParameters: ' .. sys . clock () - start .. " s" )
54
+ print (torch .type (currentModule ).. ' accGradParameters: ' .. start : time (). real .. " s" )
55
55
end
56
56
57
57
function Sequential :backward (input , gradOutput , scale )
@@ -60,17 +60,17 @@ function Sequential:profile()
60
60
local currentModule = self .modules [# self .modules ]
61
61
for i =# self .modules - 1 ,1 ,- 1 do
62
62
local previousModule = self .modules [i ]
63
- local start = sys . clock ()
63
+ local start = torch . Timer ()
64
64
currentGradOutput = currentModule :backward (previousModule .output , currentGradOutput , scale )
65
65
if cutorch then cutorch .synchronize () end
66
- print (torch .type (currentModule ).. ' backward: ' .. sys . clock () - start .. " s" )
66
+ print (torch .type (currentModule ).. ' backward: ' .. start : time (). real .. " s" )
67
67
currentModule .gradInput = currentGradOutput
68
68
currentModule = previousModule
69
69
end
70
- local start = sys . clock ()
70
+ local start = torch . Timer ()
71
71
currentGradOutput = currentModule :backward (input , currentGradOutput , scale )
72
72
if cutorch then cutorch .synchronize () end
73
- print (torch .type (currentModule ).. ' backward: ' .. sys . clock () - start .. " s" )
73
+ print (torch .type (currentModule ).. ' backward: ' .. start : time (). real .. " s" )
74
74
self .gradInput = currentGradOutput
75
75
return currentGradOutput
76
76
end
@@ -80,18 +80,18 @@ function Sequential:profile()
80
80
local currentModule = self .modules [# self .modules ]
81
81
for i =# self .modules - 1 ,1 ,- 1 do
82
82
local previousModule = self .modules [i ]
83
- local start = sys . clock ()
83
+ local start = torch . Timer ()
84
84
currentModule :accUpdateGradParameters (previousModule .output , currentGradOutput , lr )
85
85
if cutorch then cutorch .synchronize () end
86
- print (torch .type (currentModule ).. ' accUpdateGradParameters: ' .. sys . clock () - start .. " s" )
86
+ print (torch .type (currentModule ).. ' accUpdateGradParameters: ' .. start : time (). real .. " s" )
87
87
currentGradOutput = currentModule .gradInput
88
88
currentModule = previousModule
89
89
end
90
90
91
- local start = sys . clock ()
91
+ local start = torch . Timer ()
92
92
currentModule :accUpdateGradParameters (input , currentGradOutput , lr )
93
93
if cutorch then cutorch .synchronize () end
94
- print (torch .type (currentModule ).. ' accUpdateGradParameters: ' .. sys . clock () - start .. " s" )
94
+ print (torch .type (currentModule ).. ' accUpdateGradParameters: ' .. start : time (). real .. " s" )
95
95
end
96
96
97
97
parent .profile (self )
0 commit comments