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
Neel Shah
NIFTy
Commits
5c336178
Commit
5c336178
authored
May 02, 2016
by
theos
Browse files
d2o.set_full_data now also supports scalars.
parent
74a9b76c
Changes
1
Hide whitespace changes
Inline
Side-by-side
d2o/distributor_factory.py
View file @
5c336178
...
...
@@ -656,6 +656,8 @@ class _slicing_distributor(distributor):
copy
=
copy
)
return
temp_d2o
.
get_local_data
(
copy
=
False
).
astype
(
self
.
dtype
,
copy
=
False
)
elif
np
.
isscalar
(
data
):
return
np
.
ones
(
self
.
local_shape
,
dtype
=
self
.
dtype
)
*
data
else
:
return
data
[
self
.
local_start
:
self
.
local_end
].
astype
(
self
.
dtype
,
...
...
@@ -1923,6 +1925,9 @@ class _not_distributor(distributor):
new_data
=
data
.
get_full_data
()
elif
isinstance
(
data
,
np
.
ndarray
):
new_data
=
data
elif
np
.
isscalar
(
data
):
new_data
=
np
.
ones
(
self
.
global_shape
,
dtype
=
self
.
dtype
)
*
data
copy
=
False
else
:
new_data
=
np
.
array
(
data
)
return
new_data
.
astype
(
self
.
dtype
,
...
...
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