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
Open sidebar
ift
NIFTy
Commits
d66fd65f
Commit
d66fd65f
authored
Apr 28, 2016
by
theos
Browse files
Fixed dtype handling in _slicing_distributor's bincount.
parent
0bba7a71
Pipeline
#2067
skipped
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
d2o/distributed_data_object.py
View file @
d66fd65f
...
...
@@ -1424,8 +1424,9 @@ class distributed_data_object(object):
Returns
-------
out : numpy.ndarray of ints
The result of binning `self`.
out : numpy.ndarray
The result of binning `self`. The returned dtype is `int` if
no weights were given, and `np.float` otherwise.
Raises
------
...
...
@@ -1515,7 +1516,7 @@ class distributed_data_object(object):
hermitian
=
False
,
copy
=
True
,
**
kwargs
):
""" Takes the supplied `data` and distributes it to the nodes.
Essentially this method behaves like `d2o[to_key] = data[from_key]`
.
Essentially this method behaves like `d2o[to_key] = data[from_key]`
In order to makes this process efficient, the built-in distributors
do not evaluate the object `d2o[from_key]` explicitly. Instead, the
individual nodes check for the self-affecting part of `to_key`, then
...
...
d2o/distributor_factory.py
View file @
d66fd65f
...
...
@@ -1489,10 +1489,17 @@ class _slicing_distributor(distributor):
return
global_unique_data
def
bincount
(
self
,
local_data
,
local_weights
,
minlength
):
if
local_weights
is
None
:
result_dtype
=
np
.
int
else
:
result_dtype
=
np
.
float
local_counts
=
np
.
bincount
(
local_data
,
weights
=
local_weights
,
minlength
=
minlength
)
# cast the local_counts to the right dtype while avoiding copying
local_counts
=
np
.
array
(
local_counts
,
copy
=
False
,
dtype
=
result_dtype
)
global_counts
=
np
.
empty_like
(
local_counts
)
self
.
_Allreduce_helper
(
local_counts
,
global_counts
,
...
...
Write
Preview
Supports
Markdown
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