Skip to content
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

divide by zero error for empty arrays #51

Open
hartwoolery opened this issue Mar 6, 2024 · 1 comment
Open

divide by zero error for empty arrays #51

hartwoolery opened this issue Mar 6, 2024 · 1 comment

Comments

@hartwoolery
Copy link
Contributor

thank you for the wonderful Swift library -- I have a relatively minor issue where something like MfArray([]) throws a divide by zero error. I fixed it in a fork by changing one line in shape2strides func in mfstructure.swift:

ret[index] = prevAxisNum / max(shape[index],1)

(I simply made the divisor a minimum of 1)

Let me know if I should submit a pull request or if you would like to push the change. Thank you!

@jjjkkkjjj
Copy link
Owner

Thank you for reporting!
Actually i dont care about empty MfArray.
I would be happy if you could submit a pull request about that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants