Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
ift
NIFTy
Commits
4fd78c10
Commit
4fd78c10
authored
Oct 29, 2019
by
Lukas Platz
Browse files
add ift.log10, Field.log10, Linearization.log10
parent
de336041
Pipeline
#62667
passed with stages
in 7 minutes and 24 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/data_objects/distributed_do.py
View file @
4fd78c10
...
...
@@ -32,7 +32,7 @@ __all__ = ["ntask", "rank", "master", "local_shape", "data_object", "full",
"redistribute"
,
"default_distaxis"
,
"is_numpy"
,
"absmax"
,
"norm"
,
"lock"
,
"locked"
,
"uniform_full"
,
"transpose"
,
"to_global_data_rw"
,
"ensure_not_distributed"
,
"ensure_default_distributed"
,
"tanh"
,
"conjugate"
,
"sin"
,
"cos"
,
"tan"
,
"tanh"
,
"conjugate"
,
"sin"
,
"cos"
,
"tan"
,
"log10"
,
"sinh"
,
"cosh"
,
"sinc"
,
"absolute"
,
"sign"
,
"clip"
]
_comm
=
MPI
.
COMM_WORLD
...
...
@@ -297,7 +297,7 @@ def _math_helper(x, function, out):
_current_module
=
sys
.
modules
[
__name__
]
for
f
in
[
"sqrt"
,
"exp"
,
"log"
,
"tanh"
,
"conjugate"
,
"sin"
,
"cos"
,
"tan"
,
"sinh"
,
"cosh"
,
"sinc"
,
"absolute"
,
"sign"
]:
"sinh"
,
"cosh"
,
"sinc"
,
"absolute"
,
"sign"
,
"log10"
]:
def
func
(
f
):
def
func2
(
x
,
out
=
None
):
return
_math_helper
(
x
,
f
,
out
)
...
...
nifty5/data_objects/numpy_do.py
View file @
4fd78c10
...
...
@@ -18,9 +18,11 @@
# Data object module that uses simple numpy ndarrays.
import
numpy
as
np
from
numpy
import
absolute
,
clip
,
cos
,
cosh
,
empty
,
empty_like
,
exp
,
full
,
log
from
numpy
import
ndarray
as
data_object
from
numpy
import
ones
,
sign
,
sin
,
sinc
,
sinh
,
sqrt
,
tan
,
tanh
,
vdot
,
zeros
from
numpy
import
empty
,
empty_like
,
ones
,
zeros
,
full
from
numpy
import
absolute
,
sign
,
clip
,
vdot
from
numpy
import
sin
,
cos
,
sinh
,
cosh
,
tan
,
tanh
from
numpy
import
exp
,
log
,
log10
,
sqrt
,
sinc
from
.random
import
Random
...
...
@@ -34,7 +36,7 @@ __all__ = ["ntask", "rank", "master", "local_shape", "data_object", "full",
"lock"
,
"locked"
,
"uniform_full"
,
"to_global_data_rw"
,
"ensure_not_distributed"
,
"ensure_default_distributed"
,
"clip"
,
"sin"
,
"cos"
,
"tan"
,
"sinh"
,
"cosh"
,
"absolute"
,
"sign"
,
"sinc"
]
"cosh"
,
"absolute"
,
"sign"
,
"sinc"
,
"log10"
]
ntask
=
1
rank
=
0
...
...
nifty5/field.py
View file @
4fd78c10
...
...
@@ -682,7 +682,7 @@ for op in ["__iadd__", "__isub__", "__imul__", "__idiv__",
return
func2
setattr
(
Field
,
op
,
func
(
op
))
for
f
in
[
"sqrt"
,
"exp"
,
"log"
,
"tanh"
,
for
f
in
[
"sqrt"
,
"exp"
,
"log"
,
"log10"
,
"tanh"
,
"sin"
,
"cos"
,
"tan"
,
"cosh"
,
"sinh"
,
"absolute"
,
"sinc"
,
"sign"
]:
def
func
(
f
):
...
...
nifty5/linearization.py
View file @
4fd78c10
...
...
@@ -330,6 +330,11 @@ class Linearization(object):
tmp
=
self
.
_val
.
log
()
return
self
.
new
(
tmp
,
makeOp
(
1.
/
self
.
_val
)(
self
.
_jac
))
def
log10
(
self
):
tmp
=
self
.
_val
.
log10
()
tmp2
=
1.
/
(
self
.
_val
*
np
.
log
(
10
))
return
self
.
new
(
tmp
,
makeOp
(
tmp2
)(
self
.
_jac
))
def
sinh
(
self
):
tmp
=
self
.
_val
.
sinh
()
tmp2
=
self
.
_val
.
cosh
()
...
...
nifty5/operators/operator.py
View file @
4fd78c10
...
...
@@ -159,7 +159,7 @@ class Operator(metaclass=NiftyMeta):
for
f
in
[
"sqrt"
,
"exp"
,
"log"
,
"tanh"
,
"sigmoid"
,
'sin'
,
'cos'
,
'tan'
,
'sinh'
,
'cosh'
,
'absolute'
,
'sinc'
,
'one_over'
]:
'sinh'
,
'cosh'
,
'absolute'
,
'sinc'
,
'one_over'
,
'log10'
]:
def
func
(
f
):
def
func2
(
self
):
fa
=
_FunctionApplier
(
self
.
target
,
f
)
...
...
nifty5/sugar.py
View file @
4fd78c10
...
...
@@ -389,7 +389,7 @@ def domain_union(domains):
_current_module
=
sys
.
modules
[
__name__
]
for
f
in
[
"sqrt"
,
"exp"
,
"log"
,
"tanh"
,
"sigmoid"
,
for
f
in
[
"sqrt"
,
"exp"
,
"log"
,
"log10"
,
"tanh"
,
"sigmoid"
,
"conjugate"
,
'sin'
,
'cos'
,
'tan'
,
'sinh'
,
'cosh'
,
'absolute'
,
'one_over'
,
'sinc'
]:
def
func
(
f
):
...
...
test/test_field.py
View file @
4fd78c10
...
...
@@ -329,7 +329,7 @@ def test_emptydomain():
@
pmp
(
'dom'
,
[
ift
.
RGSpace
((
8
,),
harmonic
=
True
),
()])
@
pmp
(
'func'
,
[
"exp"
,
"log"
,
"sin"
,
"cos"
,
"tan"
,
"sinh"
,
"cosh"
,
"sinc"
,
"absolute"
,
"sign"
"sign"
,
"log10"
])
def
test_funcs
(
num
,
dom
,
func
):
num
=
5
...
...
test/test_linearization.py
View file @
4fd78c10
...
...
@@ -54,7 +54,7 @@ def test_special_gradients():
@
pmp
(
'f'
,
[
'log'
,
'exp'
,
'sqrt'
,
'sin'
,
'cos'
,
'tan'
,
'sinc'
,
'sinh'
,
'cosh'
,
'tanh'
,
'absolute'
,
'one_over'
,
'sigmoid'
'absolute'
,
'one_over'
,
'sigmoid'
,
'log10'
])
def
test_actual_gradients
(
f
):
dom
=
ift
.
UnstructuredDomain
((
1
,))
...
...
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