Commit 98c99805 by kice Committed by Tianqi Chen

Fix int32 range overflow by using int64 (#3870)

parent ca352770
...@@ -204,8 +204,9 @@ class SplitSpace(TransformSpace): ...@@ -204,8 +204,9 @@ class SplitSpace(TransformSpace):
def _generate_space(self, now, tmp_stack): def _generate_space(self, now, tmp_stack):
"""Generate space by DFS""" """Generate space by DFS"""
if now == self.num_outputs - 1: if now == self.num_outputs - 1:
if self.product % np.prod(tmp_stack) == 0: size = np.prod(tmp_stack, dtype=np.int64)
first = int(self.product // int(np.prod(tmp_stack))) if self.product % size == 0:
first = int(self.product // int(size))
self.entities.append(SplitEntity([first] + tmp_stack[::-1])) self.entities.append(SplitEntity([first] + tmp_stack[::-1]))
else: else:
for factor in self.factors[now]: for factor in self.factors[now]:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment