We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3925f57 commit c1be430Copy full SHA for c1be430
tests/test_ndarray.cpp
@@ -298,6 +298,32 @@ NB_MODULE(test_ndarray_ext, m) {
298
deleter);
299
});
300
301
+ m.def("ret_jax", []() {
302
+ float *f = new float[8] { 1, 2, 3, 4, 5, 6, 7, 8 };
303
+ size_t shape[2] = { 2, 4 };
304
+
305
+ nb::capsule deleter(f, [](void *data) noexcept {
306
+ destruct_count++;
307
+ delete[] (float *) data;
308
+ });
309
310
+ return nb::ndarray<nb::jax, float, nb::shape<2, 4>>(f, 2, shape,
311
+ deleter);
312
313
314
+ m.def("ret_tensorflow", []() {
315
316
317
318
319
320
321
322
323
+ return nb::ndarray<nb::tensorflow, float, nb::shape<2, 4>>(f, 2, shape,
324
325
326
327
m.def("ret_array_scalar", []() {
328
float* f = new float[1] { 1 };
329
size_t shape[1] = {};
0 commit comments