Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Max Ehrlich
cdcnn
Commits
f75864f2
Verified
Commit
f75864f2
authored
Dec 18, 2018
by
Max Ehrlich
Browse files
Fix throughput experiments
parent
35351a27
Changes
2
Show whitespace changes
Inline
Side-by-side
experiments/jpeg_throughput.py
View file @
f75864f2
...
@@ -20,19 +20,21 @@ jpeg_model = models.JpegResNet(spatial_model, n_freqs=6).to(device)
...
@@ -20,19 +20,21 @@ jpeg_model = models.JpegResNet(spatial_model, n_freqs=6).to(device)
optimizer
=
optim
.
Adam
(
jpeg_model
.
parameters
())
optimizer
=
optim
.
Adam
(
jpeg_model
.
parameters
())
t0
=
time
.
perf_counter
()
t0
=
time
.
time
()
models
.
train
(
jpeg_model
,
device
,
dataset
[
0
],
optimizer
,
0
)
models
.
train
(
jpeg_model
,
device
,
dataset
[
0
],
optimizer
,
0
)
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
t1
=
time
.
perf_counter
()
t1
=
time
.
time
()
training_time
=
t1
-
t0
training_time
=
t1
-
t0
t0
=
time
.
perf_counter
()
jpeg_model
.
explode_all
()
t0
=
time
.
time
()
models
.
test
(
jpeg_model
,
device
,
dataset
[
1
])
models
.
test
(
jpeg_model
,
device
,
dataset
[
1
])
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
t1
=
time
.
perf_counter
()
t1
=
time
.
time
()
testing_time
=
t1
-
t0
testing_time
=
t1
-
t0
with
open
(
'{}_jpeg_throughput.csv'
.
format
(
args
.
dataset
),
'w'
)
as
f
:
with
open
(
'{}_jpeg_throughput.csv'
.
format
(
args
.
dataset
),
'w'
)
as
f
:
f
.
write
(
'Training, Testing
\n
'
)
f
.
write
(
'Training, Testing
\n
'
)
f
.
write
(
'{}, {}
\n
'
.
format
(
training_time
/
len
(
dataset
[
0
])
,
test
ing_time
/
len
(
dataset
[
1
])))
f
.
write
(
'{}, {}
\n
'
.
format
(
len
(
dataset
[
0
])
/
train
ing_time
,
len
(
dataset
[
1
])
/
testing_time
))
experiments/spatial_throughput.py
View file @
f75864f2
...
@@ -20,19 +20,19 @@ spatial_model = models.SpatialResNet(dataset_info['channels'], dataset_info['cla
...
@@ -20,19 +20,19 @@ spatial_model = models.SpatialResNet(dataset_info['channels'], dataset_info['cla
optimizer
=
optim
.
Adam
(
spatial_model
.
parameters
())
optimizer
=
optim
.
Adam
(
spatial_model
.
parameters
())
t0
=
time
.
perf_counter
()
t0
=
time
.
time
()
models
.
train
(
spatial_model
,
device
,
dataset
[
0
],
optimizer
,
0
,
do_decode
=
True
)
models
.
train
(
spatial_model
,
device
,
dataset
[
0
],
optimizer
,
0
,
do_decode
=
True
)
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
t1
=
time
.
perf_counter
()
t1
=
time
.
time
()
training_time
=
t1
-
t0
training_time
=
t1
-
t0
t0
=
time
.
perf_counter
()
t0
=
time
.
time
()
models
.
test
(
spatial_model
,
device
,
dataset
[
1
],
do_decode
=
True
)
models
.
test
(
spatial_model
,
device
,
dataset
[
1
],
do_decode
=
True
)
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
t1
=
time
.
perf_counter
()
t1
=
time
.
time
()
testing_time
=
t1
-
t0
testing_time
=
t1
-
t0
with
open
(
'{}_spatial_throughput.csv'
.
format
(
args
.
dataset
),
'w'
)
as
f
:
with
open
(
'{}_spatial_throughput.csv'
.
format
(
args
.
dataset
),
'w'
)
as
f
:
f
.
write
(
'Training, Testing
\n
'
)
f
.
write
(
'Training, Testing
\n
'
)
f
.
write
(
'{}, {}
\n
'
.
format
(
training_time
/
len
(
dataset
[
0
])
,
testing_time
/
len
(
dataset
[
1
])
))
f
.
write
(
'{}, {}
\n
'
.
format
(
len
(
dataset
[
0
])
/
training_time
,
len
(
dataset
[
1
])
/
testing_time
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment