TypeError: argument 'input': 'ndarray' object is not an instance of 'ndarray'
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 141
- Avg merge
- 16m
- Merged PRs (30d)
- 3
Description
When trying to capture an Array from Python using the following input scheme:
fn _set_node_vector<'py>(
&mut self,
py: Python<'py>,
input: Bound<'py, numpy::PyArray1<Py<PyAny>>>,
) -> PyResult<()>
I have three cases:
a) Valid input: the array is correctly specified: v1 = np.array([1.0, 2.0], dtype=object)
b) Invalid i1 = np.array([1.0, 2.0]) (possibly because the dtype is float)
c) Invalid: i2 = np.array([[1.0, 2.0]], dtype=object) (shape is wrong)
In both invalid cases the error returned is:
TypeError: argument 'input': 'ndarray' object is not an instance of 'ndarray'
Bit more steering can be helpful...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the _set_node_vector signature shown in the issue and reproduce the three inputs: object-dtype 1D, default-dtype 1D, and object-dtype 2D arrays. Compare the resulting errors and make the invalid dtype and shape cases provide more useful guidance than the current generic TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python, rust
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100