Substitute of torch.Tensor.data_ptr()


Is there any work around to get the address of the first element of the NDarray?

I tried id() but it doesnt give the same address,


In Python (CPython impl) id returns the address of the python object in memory. You can get the pointer to the underlying data for an NDArray through _tvm_handle method. You can find the details in c_api.h, tensor_blob.h (that they conform to dlpack.h) and ffi declaration in src mxnet ctypes or cython.