This is not possible to do. data_ptr<float>() returns just a raw pointer to float. We cannot attach any reference or anything to it.
It is the same as if you get a raw pointer to an object in cpp and then delete the object. The raw pointer never keeps the object alive.
Note that in cpython, the life of objects is refcounted and so (unless you create refcycle which are very rare), they are destroyed as soon as they are not referenced anymore.