Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
1b646049
Commit
1b646049
authored
Aug 09, 2021
by
Philipp Arras
Browse files
Do not allocate arrays
parent
7baf3e1d
Pipeline
#107328
passed with stages
in 21 minutes
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/operators/jax_operator.py
View file @
1b646049
...
...
@@ -14,6 +14,8 @@
# Copyright(C) 2021 Max-Planck-Society
# Author: Philipp Arras
from
types
import
SimpleNamespace
import
numpy
as
np
from
.energy_operators
import
LikelihoodEnergyOperator
...
...
@@ -139,9 +141,10 @@ class JaxLinearOperator(LinearOperator):
domain
=
makeDomain
(
domain
)
if
domain_dtype
is
not
None
and
func_T
is
None
:
if
isinstance
(
domain
,
DomainTuple
):
inp
=
np
.
empty
(
domain
.
shape
,
domain_dtype
)
inp
=
SimpleNamespace
(
shape
=
domain
.
shape
,
dtype
=
domain_dtype
)
else
:
inp
=
{
kk
:
np
.
empty
(
domain
[
kk
].
shape
,
domain_dtype
[
kk
])
for
kk
in
domain
.
keys
()}
inp
=
{
kk
:
SimpleNameSpace
(
shape
=
domain
[
kk
].
shape
,
dtype
=
domain_dtype
[
kk
])
for
kk
in
domain
.
keys
()}
func_T
=
jax
.
jit
(
jax
.
linear_transpose
(
func
,
inp
))
elif
domain_dtype
is
None
and
func_T
is
not
None
:
pass
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment