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
b5e64aeb
Commit
b5e64aeb
authored
2 years ago
by
Tamino Huxohl
Browse files
Options
Downloads
Patches
Plain Diff
convert some string equals to in checks for more flexibility
parent
03163d47
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mu_map/dataset/normalization.py
+3
-3
3 additions, 3 deletions
mu_map/dataset/normalization.py
mu_map/training/loss.py
+3
-3
3 additions, 3 deletions
mu_map/training/loss.py
with
6 additions
and
6 deletions
mu_map/dataset/normalization.py
+
3
−
3
View file @
b5e64aeb
...
...
@@ -124,11 +124,11 @@ def norm_by_str(norm: Optional[str]) -> Optional[NormTransform]:
return
None
norm
=
norm
.
lower
()
if
norm
==
"
mean
"
:
if
"
mean
"
in
norm
:
return
MeanNormTransform
()
elif
norm
==
"
max
"
:
elif
"
max
"
in
norm
:
return
MaxNormTransform
()
elif
norm
==
"
gaussian
"
:
elif
"
gaussian
"
in
norm
:
return
GaussianNormTransform
()
raise
ValueError
(
f
"
Unknown normalization
{
norm
}
"
)
...
...
This diff is collapsed.
Click to expand it.
mu_map/training/loss.py
+
3
−
3
View file @
b5e64aeb
...
...
@@ -28,11 +28,11 @@ def loss_by_string(loss_str: str) -> nn.Module:
:returns: an executable loss function
"""
loss_str
=
loss_str
.
lower
()
if
loss_str
==
"
l1
"
:
if
"
l1
"
in
loss_str
:
return
nn
.
L1Loss
(
reduction
=
"
mean
"
)
elif
loss_str
==
"
l2
"
or
loss_str
==
"
mse
"
:
elif
"
l2
"
in
loss_str
or
"
mse
"
in
loss_str
:
return
nn
.
MSELoss
(
reduction
=
"
mean
"
)
elif
loss_str
==
"
g
dl
"
:
elif
"
gdl
"
in
loss_str
or
"
g
radientdifferenceloss
"
in
loss_str
:
return
GradientDifferenceLoss
()
else
:
raise
ValueError
(
f
"
Unknown loss function:
{
loss_str
}
"
)
...
...
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