You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/11/27 19:09:30 UTC
[GitHub] zhanghang1989 closed pull request #12803: Fix Extremely Unbalanced
Issue in split_and_load
zhanghang1989 closed pull request #12803: Fix Extremely Unbalanced Issue in split_and_load
URL: https://github.com/apache/incubator-mxnet/pull/12803
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/python/mxnet/gluon/utils.py b/python/mxnet/gluon/utils.py
index d5a14a6859a..5a0c2572cfa 100644
--- a/python/mxnet/gluon/utils.py
+++ b/python/mxnet/gluon/utils.py
@@ -22,6 +22,7 @@
'check_sha1', 'download']
import os
+import math
import hashlib
import warnings
import collections
@@ -72,7 +73,7 @@ def split_data(data, num_slice, batch_axis=0, even_split=True):
"uneven partitioning of data."%(
str(data.shape), num_slice, batch_axis, num_slice))
- step = size // num_slice
+ step = math.ceil(1.0 * size / num_slice)
if batch_axis == 0:
slices = [data[i*step:(i+1)*step] if i < num_slice - 1 else data[i*step:size]
for i in range(num_slice)]
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services