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
Commits
9f7abcf1
Commit
9f7abcf1
authored
3 weeks ago
by
Jakob Roth
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_nullop_stat_ncg' into 'NIFTy_8'
_static_newton_cg: Fix maxiter==0 handling Closes
#426
See merge request
!1009
parents
100c6cb9
88b56d4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1009
_static_newton_cg: Fix maxiter==0 handling
Pipeline
#246100
passed
3 weeks ago
Stage: build_docker
Stage: test
Stage: release
Stage: demo_runs
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/re/optimize.py
+7
-5
7 additions, 5 deletions
src/re/optimize.py
with
7 additions
and
5 deletions
src/re/optimize.py
+
7
−
5
View file @
9f7abcf1
...
...
@@ -327,8 +327,8 @@ def _static_newton_cg(
energy
,
g
=
fun_and_grad
(
pos
)
conditional_raise
(
jnp
.
isnan
(
energy
),
ValueError
(
"
energy is Nan
"
))
val
=
{
"
status
"
:
-
2
,
"
iteration
"
:
1
,
"
status
"
:
jnp
.
where
(
maxiter
==
0
,
0
,
-
2
)
,
"
iteration
"
:
0
,
"
pos
"
:
pos
,
"
energy
"
:
energy
,
"
old_energy
"
:
old_fval
if
old_fval
is
not
None
else
jnp
.
inf
,
...
...
@@ -342,7 +342,7 @@ def _static_newton_cg(
return
v
[
"
status
"
]
<
-
1
def
single_newton_cg_step
(
v
):
status
,
i
=
v
[
"
status
"
],
v
[
"
iteration
"
]
status
,
i
=
v
[
"
status
"
],
v
[
"
iteration
"
]
+
1
pos
=
v
[
"
pos
"
]
energy
,
g
=
v
[
"
energy
"
],
v
[
"
g
"
]
old_energy
=
v
[
"
old_energy
"
]
...
...
@@ -419,7 +419,7 @@ def _static_newton_cg(
ret
=
{
"
status
"
:
status
,
"
iteration
"
:
i
+
1
,
"
iteration
"
:
i
,
"
pos
"
:
pos
,
"
energy
"
:
energy
,
"
old_energy
"
:
old_energy
,
...
...
@@ -432,7 +432,9 @@ def _static_newton_cg(
val
=
while_loop
(
continue_condition_newton_cg
,
single_newton_cg_step
,
val
)
conditional_call
(
val
[
"
status
"
]
>
0
,
logger
.
error
,
PyTreeString
(
f
"
{
nm
}
: Iteration Limit Reached!
"
)
(
val
[
"
status
"
]
>
0
)
|
(
maxiter
==
0
),
logger
.
error
,
PyTreeString
(
f
"
{
nm
}
: Iteration Limit Reached!
"
),
)
return
OptimizeResults
(
x
=
val
[
"
pos
"
],
...
...
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