Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Merge requests
!321
Fixing NaNs in PoissonEnergy
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fixing NaNs in PoissonEnergy
fixing_nan
into
NIFTy_5
Overview
0
Commits
3
Pipelines
3
Changes
1
Merged
Martin Reinecke
requested to merge
fixing_nan
into
NIFTy_5
6 years ago
Overview
0
Commits
3
Pipelines
3
Changes
1
Expand
0
0
Merge request reports
Compare
NIFTy_5
version 1
a7325040
6 years ago
NIFTy_5 (base)
and
latest version
latest version
dafe2922
3 commits,
6 years ago
version 1
a7325040
2 commits,
6 years ago
1 file
+
6
−
1
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
nifty5/operators/energy_operators.py
+
6
−
1
Options
@@ -191,7 +191,12 @@ class PoissonianEnergy(EnergyOperator):
@@ -191,7 +191,12 @@ class PoissonianEnergy(EnergyOperator):
def
apply
(
self
,
x
):
def
apply
(
self
,
x
):
self
.
_check_input
(
x
)
self
.
_check_input
(
x
)
res
=
x
.
sum
()
-
x
.
log
().
vdot
(
self
.
_d
)
res
=
x
.
sum
()
tmp
=
res
.
val
.
local_data
if
isinstance
(
res
,
Linearization
)
else
res
# if we have no infinity here, we can continue with the calculation;
# otherwise we know that the result must also be infinity
if
not
np
.
isinf
(
tmp
):
res
=
res
-
x
.
log
().
vdot
(
self
.
_d
)
if
not
isinstance
(
x
,
Linearization
):
if
not
isinstance
(
x
,
Linearization
):
return
Field
.
scalar
(
res
)
return
Field
.
scalar
(
res
)
if
not
x
.
want_metric
:
if
not
x
.
want_metric
:
Loading