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
357cd238
Commit
357cd238
authored
9 months ago
by
Matteo Guardiani
Browse files
Options
Downloads
Patches
Plain Diff
408-host_callback_deprecated: address review.
parent
4e99866a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!937
Resolve "host_callback_depricated"
Pipeline
#207168
passed
9 months ago
Stage: build_docker
Stage: test
Stage: demo_runs
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/re/hmc.py
+4
-4
4 additions, 4 deletions
src/re/hmc.py
src/re/optimize.py
+2
-2
2 additions, 2 deletions
src/re/optimize.py
with
6 additions
and
6 deletions
src/re/hmc.py
+
4
−
4
View file @
357cd238
...
@@ -6,7 +6,7 @@ from typing import Callable, NamedTuple, TypeVar, Union
...
@@ -6,7 +6,7 @@ from typing import Callable, NamedTuple, TypeVar, Union
from
jax
import
lax
from
jax
import
lax
from
jax
import
numpy
as
jnp
from
jax
import
numpy
as
jnp
from
jax
import
random
,
tree_util
from
jax
import
random
,
tree_util
from
jax.
experimental
import
host_
callback
from
jax.
debug
import
callback
from
jax.scipy.special
import
expit
from
jax.scipy.special
import
expit
from
.lax
import
cond
,
fori_loop
,
while_loop
from
.lax
import
cond
,
fori_loop
,
while_loop
...
@@ -124,7 +124,7 @@ def leapfrog_step(
...
@@ -124,7 +124,7 @@ def leapfrog_step(
global
_DEBUG_FLAG
global
_DEBUG_FLAG
if
_DEBUG_FLAG
:
if
_DEBUG_FLAG
:
# append result to global list variable
# append result to global list variable
host_
callback
.
call
(
_DEBUG_ADD_QP
,
qp_fullstep
)
callback
(
_DEBUG_ADD_QP
,
qp_fullstep
)
return
qp_fullstep
return
qp_fullstep
...
@@ -357,7 +357,7 @@ def generate_nuts_tree(
...
@@ -357,7 +357,7 @@ def generate_nuts_tree(
global
_DEBUG_FLAG
global
_DEBUG_FLAG
if
_DEBUG_FLAG
:
if
_DEBUG_FLAG
:
host_
callback
.
call
(
_DEBUG_FINISH_TREE
,
None
)
callback
(
_DEBUG_FINISH_TREE
,
None
)
return
current_tree
return
current_tree
...
@@ -544,7 +544,7 @@ def iterative_build_tree(
...
@@ -544,7 +544,7 @@ def iterative_build_tree(
global
_DEBUG_FLAG
global
_DEBUG_FLAG
if
_DEBUG_FLAG
:
if
_DEBUG_FLAG
:
host_
callback
.
call
(
_DEBUG_FINISH_SUBTREE
,
None
)
callback
(
_DEBUG_FINISH_SUBTREE
,
None
)
# The depth of a tree which was aborted early is possibly ill defined
# The depth of a tree which was aborted early is possibly ill defined
depth
=
jnp
.
where
(
n
==
max_num_proposals
,
depth
,
-
1
)
depth
=
jnp
.
where
(
n
==
max_num_proposals
,
depth
,
-
1
)
...
...
This diff is collapsed.
Click to expand it.
src/re/optimize.py
+
2
−
2
View file @
357cd238
...
@@ -274,7 +274,7 @@ def _trust_ncg(
...
@@ -274,7 +274,7 @@ def _trust_ncg(
subproblem_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
None
,
subproblem_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
None
,
name
:
Optional
[
str
]
=
None
name
:
Optional
[
str
]
=
None
)
->
OptimizeResults
:
)
->
OptimizeResults
:
from
jax.
experimental.host_callback
import
call
from
jax.
debug
import
call
back
maxiter
=
200
if
maxiter
is
None
else
maxiter
maxiter
=
200
if
maxiter
is
None
else
maxiter
...
@@ -421,7 +421,7 @@ def _trust_ncg(
...
@@ -421,7 +421,7 @@ def _trust_ncg(
"
nhev
"
:
params
.
nhev
,
"
nhev
"
:
params
.
nhev
,
"
hit
"
:
sub_result
.
hits_boundary
"
hit
"
:
sub_result
.
hits_boundary
}
}
call
(
pp
,
printable_state
,
result_shape
=
None
)
call
back
(
pp
,
printable_state
,
result_shape
=
None
)
return
params
return
params
def
_trust_region_cond_f
(
params
:
_TrustRegionState
)
->
bool
:
def
_trust_region_cond_f
(
params
:
_TrustRegionState
)
->
bool
:
...
...
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