Yes exactly if you’re using pycuda, this is the way to go.
If you use other custom stuff, you can access the cuda pointer pointing at your data with t.data_ptr() (you can see how it’s used in the gist you linked).