Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Calo Opt_Nikhil
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Krishna Krishna Nikhil
Calo Opt_Nikhil
Commits
d2bf339d
Commit
d2bf339d
authored
11 months ago
by
Krishna Krishna Nikhil
Browse files
Options
Downloads
Patches
Plain Diff
Update 2 optimizer.py
parent
fa0c217b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/optimizer.py
+2
-3
2 additions, 3 deletions
modules/optimizer.py
with
2 additions
and
3 deletions
modules/optimizer.py
+
2
−
3
View file @
d2bf339d
...
...
@@ -72,7 +72,7 @@ class Optimizer(object):
total_length_loss
=
torch
.
mean
(
100.
*
torch
.
nn
.
ReLU
()(
detector_length
-
self
.
constraints
[
'
length
'
])
**
2
)
#constrain it to 25cm
if
'
lower
'
in
self
.
constraints
:
lbound
=
(
torch
.
ones
(
12
)
*
self
.
constraints
[
'
lower
'
]).
to
(
self
.
device
)
lower_loss
=
torch
.
mean
(
100
0
.
*
torch
.
nn
.
ReLU
()(
lbound
-
raw_detector_parameters
)
**
2
)
lower_loss
=
torch
.
mean
(
100.
*
torch
.
nn
.
ReLU
()(
lbound
-
raw_detector_parameters
)
**
2
)
if
'
upper
'
in
self
.
constraints
:
ubound
=
(
torch
.
ones
(
6
)
*
self
.
constraints
[
'
upper
'
]).
to
(
self
.
device
)
upper_loss
=
torch
.
mean
(
100.
*
torch
.
nn
.
ReLU
()(
material_parameters
-
ubound
)
**
2
)
...
...
@@ -114,8 +114,7 @@ class Optimizer(object):
return
total_length_loss
+
lower_loss
+
upper_loss
+
diff_loss
+
cost_loss
def
clamp_parameters
(
self
):
return
self
.
detector_parameters
=
self
.
detector_parameters
.
clamp
(
1e-3
)
#DEBUG, NE
self
.
detector_parameters
.
data
=
self
.
detector_parameters
.
data
.
clamp
(
1e-3
)
#DEBUG, NE
def
adjust_generator_covariance
(
self
,
direction
,
min_scale
=
2.0
):
#stretches the box_covariance of the generator in the directon specified as input
...
...
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