-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update leaf.py #1010
base: master
Are you sure you want to change the base?
Update leaf.py #1010
Conversation
avoid RuntimeWarning: overflow encountered in long_scalars
@@ -316,7 +316,7 @@ def _calc_chunkshape(self, expectedrows, rowsize, itemsize): | |||
|
|||
# Compute the chunksize | |||
MB = 1024 * 1024 | |||
expected_mb = (expectedrows * rowsize) // MB | |||
expected_mb = np.int32((np.int64(expectedrows) * rowsize) // MB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I have not analysed the problem in depth but the need of a double casting looks very strange to me.
What is the data type of expectedrows
normally?
In any case Python int
should never be subject to overflow. Is it not enough to have a single cast to int
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wony-zheng could you please confirm that the following path works for you?
- expected_mb = (expectedrows * rowsize) // MB
+ expected_mb = (int(expectedrows) * rowsize) // MB)
@@ -316,7 +316,7 @@ def _calc_chunkshape(self, expectedrows, rowsize, itemsize): | |||
|
|||
# Compute the chunksize | |||
MB = 1024 * 1024 | |||
expected_mb = (expectedrows * rowsize) // MB | |||
expected_mb = np.int32((np.int64(expectedrows) * rowsize) // MB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wony-zheng could you please confirm that the following path works for you?
- expected_mb = (expectedrows * rowsize) // MB
+ expected_mb = (int(expectedrows) * rowsize) // MB)
avoid RuntimeWarning: overflow encountered in long_scalars