Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
06f6250f
Commit
06f6250f
authored
May 25, 2020
by
Martin Reinecke
Browse files
Merge remote-tracking branch 'origin/NIFTy_6' into NIFTy_7
parents
42a2e155
05fe4e59
Pipeline
#75508
passed with stages
in 9 minutes and 16 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
06f6250f
...
...
@@ -142,3 +142,85 @@ and a citation to one of the [publications](http://ift.pages.mpcdf.de/nifty/cita
The NIFTy package is licensed under the terms of the
[
GPLv3
](
https://www.gnu.org/licenses/gpl.html
)
and is distributed
*without any warranty*
.
Contributors
------------
Find the list of all people who authored commits in this repository.
### NIFTy6
-
Andrija Kostic
-
Gordian Edenhofer
-
Lukas Platz
-
Martin Reinecke
-
[
Philipp Arras
](
https://wwwmpa.mpa-garching.mpg.de/~parras/
)
-
Philipp Frank
-
Philipp Haim
-
[
Reimar Heinrich Leike
](
https://wwwmpa.mpa-garching.mpg.de/~reimar/
)
-
Rouven Lemmerz
-
[
Torsten Enßlin
](
https://wwwmpa.mpa-garching.mpg.de/~ensslin/
)
-
Vincent Eberle
### NIFTy5
-
Christoph Lienhard
-
Gordian Edenhofer
-
Jakob Knollmüller
-
Julia Stadler
-
Julian Rüstig
-
Lukas Platz
-
Martin Reinecke
-
Max-Niklas Newrzella
-
Natalia
-
[
Philipp Arras
](
https://wwwmpa.mpa-garching.mpg.de/~parras/
)
-
Philipp Frank
-
Philipp Haim
-
Reimar Heinrich Leike
-
Sebastian Hutschenreuter
-
Silvan Streit
-
[
Torsten Enßlin
](
https://wwwmpa.mpa-garching.mpg.de/~ensslin/
)
### NIFTy4
-
Christoph Lienhard
-
Jakob Knollmüller
-
Lukas Platz
-
Martin Reinecke
-
Mihai Baltac
-
[
Philipp Arras
](
https://wwwmpa.mpa-garching.mpg.de/~parras/
)
-
Philipp Frank
-
Reimar Heinrich Leike
-
Silvan Streit
-
[
Torsten Enßlin
](
https://wwwmpa.mpa-garching.mpg.de/~ensslin/
)
### NIFTy3
-
Daniel Pumpe
-
Jait Dixit
-
Jakob Knollmüller
-
Martin Reinecke
-
Mihai Baltac
-
Natalia
-
[
Philipp Arras
](
https://wwwmpa.mpa-garching.mpg.de/~parras/
)
-
Philipp Frank
-
Reimar Heinrich Leike
-
Matevz Sraml
-
Theo Steininger
-
csongor
### NIFTy2
-
Jait Dixit
-
Theo Steininger
-
csongor
### NIFTy1
-
Johannes Buchner
-
Marco Selig
-
Theo Steininger
demos/getting_started_5_mf.py
View file @
06f6250f
...
...
@@ -116,7 +116,7 @@ if __name__ == '__main__':
iteration_limit
=
35
)
ic_sampling
.
enable_logging
()
ic_newton
.
enable_logging
()
minimizer
=
ift
.
NewtonCG
(
ic_newton
,
activat
e_logging
=
True
)
minimizer
=
ift
.
NewtonCG
(
ic_newton
,
enabl
e_logging
=
True
)
## number of samples used to estimate the KL
N_samples
=
20
...
...
src/minimization/descent_minimizers.py
View file @
06f6250f
...
...
@@ -167,7 +167,7 @@ class NewtonCG(DescentMinimizer):
def
__init__
(
self
,
controller
,
napprox
=
0
,
line_searcher
=
None
,
name
=
None
,
nreset
=
20
,
max_cg_iterations
=
200
,
energy_reduction_factor
=
0.1
,
activat
e_logging
=
False
):
enabl
e_logging
=
False
):
if
line_searcher
is
None
:
line_searcher
=
LineSearch
(
preferred_initial_step_size
=
1.
)
super
(
NewtonCG
,
self
).
__init__
(
controller
=
controller
,
...
...
@@ -178,7 +178,7 @@ class NewtonCG(DescentMinimizer):
self
.
_max_cg_iterations
=
max_cg_iterations
self
.
_alpha
=
energy_reduction_factor
from
.iteration_controllers
import
EnergyHistory
self
.
_history
=
EnergyHistory
()
if
activat
e_logging
else
None
self
.
_history
=
EnergyHistory
()
if
enabl
e_logging
else
None
def
get_descent_direction
(
self
,
energy
,
old_value
=
None
):
if
old_value
is
None
:
...
...
src/minimization/iteration_controllers.py
View file @
06f6250f
...
...
@@ -43,7 +43,7 @@ class IterationController(metaclass=NiftyMeta):
For analyzing minimization procedures IterationControllers can log energy
values together with the respective time stamps. In order to activate this
feature `
activat
e_logging()` needs to be called.
feature `
enabl
e_logging()` needs to be called.
"""
CONVERGED
,
CONTINUE
,
ERROR
=
list
(
range
(
3
))
...
...
@@ -107,6 +107,9 @@ class EnergyHistory(object):
def
reset
(
self
):
self
.
_lst
=
[]
def
__getitem__
(
self
,
i
):
return
self
.
_lst
[
i
]
@
property
def
time_stamps
(
self
):
return
[
x
for
x
,
_
in
self
.
_lst
]
...
...
src/operators/einsum.py
View file @
06f6250f
...
...
@@ -262,8 +262,11 @@ class LinearEinsum(LinearOperator):
iss
,
oss
,
*
_
=
subscripts
.
split
(
"->"
)
iss_spl
=
iss
.
split
(
","
)
adj_iss
=
","
.
join
((
","
.
join
(
iss_spl
[:
-
1
]),
oss
))
self
.
_adj_sscr
=
"->"
.
join
((
adj_iss
,
iss_spl
[
-
1
]))
if
len
(
iss_spl
)
==
1
:
self
.
_adj_sscr
=
"->"
.
join
((
oss
,
iss
))
else
:
adj_iss
=
","
.
join
((
","
.
join
(
iss_spl
[:
-
1
]),
oss
))
self
.
_adj_sscr
=
"->"
.
join
((
adj_iss
,
iss_spl
[
-
1
]))
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
def
apply
(
self
,
x
,
mode
):
...
...
test/test_kl.py
View file @
06f6250f
...
...
@@ -94,7 +94,7 @@ def test_kl(constants, point_estimates, mirror_samples, mf):
# Test constants (after some minimization)
cg
=
ift
.
GradientNormController
(
iteration_limit
=
5
)
minimizer
=
ift
.
NewtonCG
(
cg
,
activat
e_logging
=
True
)
minimizer
=
ift
.
NewtonCG
(
cg
,
enabl
e_logging
=
True
)
kl
,
_
=
minimizer
(
kl
)
if
len
(
constants
)
!=
2
:
assert_
(
len
(
minimizer
.
inversion_history
)
>
0
)
...
...
test/test_operators/test_einsum.py
View file @
06f6250f
...
...
@@ -111,6 +111,23 @@ class _SwitchSpacesOperator(ift.LinearOperator):
return
ift
.
Field
(
self
.
_tgt
(
mode
),
np
.
moveaxis
(
x
.
val
,
*
args
))
def
test_linear_einsum_transpose
(
space1
,
space2
,
dtype
,
n_invocations
=
10
):
dom
=
ift
.
DomainTuple
.
make
((
space1
,
space2
))
mf
=
ift
.
MultiField
.
from_dict
({})
ss
=
"ij->ji"
le
=
ift
.
LinearEinsum
(
dom
,
mf
,
ss
)
assert_
(
consistency_check
(
le
,
domain_dtype
=
dtype
,
target_dtype
=
dtype
)
is
None
)
# SwitchSpacesOperator is equivalent to LinearEinsum with "ij->ji"
le_ift
=
_SwitchSpacesOperator
(
dom
,
1
)
for
_
in
range
(
n_invocations
):
r
=
ift
.
from_random
(
le
.
domain
,
"normal"
,
dtype
=
dtype
)
assert_allclose
(
le
(
r
).
val
,
le_ift
(
r
).
val
)
r_adj
=
ift
.
from_random
(
le
.
target
,
"normal"
,
dtype
=
dtype
)
assert_allclose
(
le
.
adjoint
(
r_adj
).
val
,
le_ift
.
adjoint
(
r_adj
).
val
)
def
test_multi_linear_einsum_outer
(
space1
,
space2
,
dtype
):
ntries
=
10
n_invocations
=
5
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment