Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mu-map
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tamino Huxohl
mu-map
Commits
6d5bbf9c
Commit
6d5bbf9c
authored
2 years ago
by
Tamino Huxohl
Browse files
Options
Downloads
Patches
Plain Diff
test speed and max batch size of UNet model
parent
6d14f212
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mu_map/models/unet.py
+22
-2
22 additions, 2 deletions
mu_map/models/unet.py
with
22 additions
and
2 deletions
mu_map/models/unet.py
+
22
−
2
View file @
6d5bbf9c
...
@@ -154,10 +154,30 @@ class UNet(nn.Module):
...
@@ -154,10 +154,30 @@ class UNet(nn.Module):
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
import
torch
import
torch
net
=
UNet
(
features
=
[
64
,
128
,
256
])
net
=
UNet
(
features
=
[
64
,
128
,
256
,
512
])
print
(
net
)
print
(
net
)
_inputs
=
torch
.
rand
((
1
,
1
,
64
,
64
,
64
))
_inputs
=
torch
.
rand
((
1
,
1
,
64
,
128
,
128
))
_outputs
=
net
(
_inputs
)
_outputs
=
net
(
_inputs
)
print
(
f
"
Transform
{
_inputs
.
shape
}
to
{
_outputs
.
shape
}
"
)
print
(
f
"
Transform
{
_inputs
.
shape
}
to
{
_outputs
.
shape
}
"
)
import
time
device
=
torch
.
device
(
"
cuda
"
)
net
=
net
.
to
(
device
)
iterations
=
100
for
batch_size
in
range
(
1
,
17
):
since
=
time
.
time
()
for
i
in
range
(
iterations
):
print
(
f
"
{
str
(
batch_size
)
:
>
2
}
/17 -
{
str
(
i
+
1
)
:
>
3
}
/
{
iterations
}
"
,
end
=
"
\r
"
)
_inputs
=
torch
.
rand
((
batch_size
,
1
,
64
,
128
,
128
))
_inputs
=
_inputs
.
to
(
device
)
_outputs
=
net
(
_inputs
)
_took
=
time
.
time
()
-
since
print
(
f
"
Batches of size
{
batch_size
}
take
{
_took
:
.
3
f
}
s on average
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment