torch.Tensor.const_data_ptr#
- Tensor.const_data_ptr() int#
Returns the address of the first element of
selftensor.Unlike
data_ptr(), this is guaranteed to be a read-only access that will not trigger copy-on-write materialization. For regular (non-COW) tensors, the return value is identical todata_ptr().Warning
The returned pointer must not be used to mutate the tensor data. Use
data_ptr()when write access is needed.