Get a tensors memory address

Hi there!

Is there a possibility to get a tensors memory address? Like an equivalent to torch’s .data_ptr()?

Thanks in advance!


You can access the memory address of a tensor using the id() function.

import tensorflow as tf
a = tf.constant([1, 2, 3])

Thank you!

1 Like