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
402e6dc3
Commit
402e6dc3
authored
10 months ago
by
Krishna Krishna Nikhil
Browse files
Options
Downloads
Patches
Plain Diff
Update reconstruction.py
parent
ff352667
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/reconstruction.py
+12
-3
12 additions, 3 deletions
modules/reconstruction.py
with
12 additions
and
3 deletions
modules/reconstruction.py
+
12
−
3
View file @
402e6dc3
...
...
@@ -15,6 +15,13 @@ class Reconstruction(torch.nn.Module):
super
(
Reconstruction
,
self
).
__init__
()
self
.
n_parameters
=
n_detector_parameters
self
.
preprocess
=
torch
.
nn
.
Sequential
(
torch
.
nn
.
Linear
(
n_detector_parameters
,
100
),
torch
.
nn
.
ELU
(),
torch
.
nn
.
Linear
(
100
,
100
),
torch
.
nn
.
ELU
(),
torch
.
nn
.
Linear
(
100
,
n_input_parameters
)
)
# take into account that
self
.
layers
=
torch
.
nn
.
Sequential
(
#torch.nn.BatchNorm1d(n_detector_parameters + n_input_parameters),
...
...
@@ -35,8 +42,10 @@ class Reconstruction(torch.nn.Module):
def
forward
(
self
,
detector_parameters
,
x
):
# concatenate the detector parameters and the input
x
=
torch
.
cat
([
detector_parameters
,
x
],
dim
=
1
)
return
self
.
layers
(
x
)
scaling_factors
=
self
.
preprocess
(
detector_parameters
)
x_scaled
=
torch
.
multiply
(
x
,
scaling_factors
)
concatenated_input
=
torch
.
cat
([
detector_parameters
,
x_scaled
],
dim
=
1
)
return
self
.
layers
(
concatenated_input
)
def
loss
(
self
,
y_pred
,
y
):
#to make it more stable filter nans or infs based on the predicted first from y, then from pedicted
...
...
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