MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / ndarray_dec_ref

Function ndarray_dec_ref

Source/Falcor/Utils/Scripting/ndarray.cpp:653–688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

651}
652
653void ndarray_dec_ref(ndarray_handle* th) noexcept
654{
655 if (!th)
656 return;
657 size_t rc_value = th->refcount--;
658
659 if (rc_value == 0)
660 {
661 pybind11_fail("ndarray_dec_ref(): reference count became negative!");
662 }
663 else if (rc_value == 1)
664 {
665 Py_XDECREF(th->owner);
666 managed_dltensor* mt = th->ndarray;
667 if (th->free_shape)
668 {
669 PyMem_Free(mt->dltensor.shape);
670 mt->dltensor.shape = nullptr;
671 }
672 if (th->free_strides)
673 {
674 PyMem_Free(mt->dltensor.strides);
675 mt->dltensor.strides = nullptr;
676 }
677 if (th->call_deleter)
678 {
679 if (mt->deleter)
680 mt->deleter(mt);
681 }
682 else
683 {
684 PyMem_Free(mt);
685 }
686 PyMem_Free(th);
687 }
688}
689
690ndarray_handle* ndarray_create(
691 void* value,

Callers 5

nb_ndarray_deallocFunction · 0.85
ndarray_createFunction · 0.85
~ndarrayMethod · 0.85
ndarrayClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected