Is there a way to validate the input dtype? #479
Unanswered
andresliszt
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks for this amazing project!. I'm exposing this function to python, this has to be the more informative it can, for example internally my Rust code uses an
Array1<f64>
, but I let the user passPyReadonlyArrayDyn<'py, f64>
instead ofPyReadonlyArray1<'py, f64>
because I want to raise the proper error when the dimension is not 1. My problem, and looks like it's difficult, it's to control thedtype
, If the user gives to the function something likenp.array([1,0])
which is not float, I get this errorTypeError: argument 'individual': 'ndarray' object cannot be converted to 'PyArray<T, D>'
Which is too generic. Is validate directly in the python code the only solution for this?. My code snippet is below, thanks
Beta Was this translation helpful? Give feedback.
All reactions