Title: fix: ->jvm on object-dtype numpy arrays with np-array bindings by jsavyasachi · Pull Request #288 · clj-python/libpython-clj · GitHub
Open Graph Title: fix: ->jvm on object-dtype numpy arrays with np-array bindings by jsavyasachi · Pull Request #288 · clj-python/libpython-clj
X Title: fix: ->jvm on object-dtype numpy arrays with np-array bindings by jsavyasachi · Pull Request #288 · clj-python/libpython-clj
Description: Fixes #187. With the libpython-clj2.python.np-array zero-copy bindings loaded, ->jvm on an object-dtype array threw Unable to find datatype: object: (require-python '[numpy :as np]) (require '[libpython-clj2.python.np-array]) (py/->jvm (np/array [] :dtype "object")) ;; => ExceptionInfo "Unable to find datatype: object" Without the bindings it returns [] (the default sequence conversion). Cause: the pyobject->jvm :ndarray method the bindings register always runs numpy->desc -> obj-dtype->dtype, which only maps numeric dtypes (int/uint/float). Object/str/datetime arrays hold python-object pointers, not a numeric native buffer, so they can't be zero-copied and have no mapping. Fix: only take the tensor path when the dtype is numeric; otherwise fall back to the default element-wise copy conversion (the same path used when the bindings aren't loaded). Added a regression test to numpy_test.clj (empty and mixed object arrays).
Open Graph Description: Fixes #187. With the libpython-clj2.python.np-array zero-copy bindings loaded, ->jvm on an object-dtype array threw Unable to find datatype: object: (require-python '[numpy :as np]) (require...
X Description: Fixes #187. With the libpython-clj2.python.np-array zero-copy bindings loaded, ->jvm on an object-dtype array threw Unable to find datatype: object: (require-python '[numpy :as np]) ...
Opengraph URL: https://github.com/clj-python/libpython-clj/pull/288
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:76c2259e-8868-0610-2fba-4e4ef89894d4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D56C:38EA7E:5C04F:7E826:6A6156FC |
| html-safe-nonce | 2a6a890b146e75767632b6df4188f944e7d8a5c089b694b0fe47938dabb54f11 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTZDOjM4RUE3RTo1QzA0Rjo3RTgyNjo2QTYxNTZGQyIsInZpc2l0b3JfaWQiOiIzMTcwNDk3NzkxMTQ1MzY3MjkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | acda45d9caaadc8ad33c65071e9f6bb01df7a52e7b576e347fb484261c7ea6bf |
| hovercard-subject-tag | pull_request:3917189426 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/clj-python/libpython-clj/pull/288/files |
| twitter:image | https://avatars.githubusercontent.com/u/25380661?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/25380661?s=400&v=4 |
| og:image:alt | Fixes #187. With the libpython-clj2.python.np-array zero-copy bindings loaded, ->jvm on an object-dtype array threw Unable to find datatype: object: (require-python '[numpy :as np]) (require... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c258d2b06b498220e3b94af28b26bbbf58f4203a6373725f779afcc867afd263 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/clj-python/libpython-clj git https://github.com/clj-python/libpython-clj.git |
| octolytics-dimension-user_id | 60827878 |
| octolytics-dimension-user_login | clj-python |
| octolytics-dimension-repository_id | 187095617 |
| octolytics-dimension-repository_nwo | clj-python/libpython-clj |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 187095617 |
| octolytics-dimension-repository_network_root_nwo | clj-python/libpython-clj |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bae60047c72c7890f36d34d78461f3453c546ee2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width