Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Remove ggml::Tensor::set_data
Browse files Browse the repository at this point in the history
  • Loading branch information
iacore committed Apr 7, 2023
1 parent eab7235 commit 91a140b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ggml/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,17 @@ impl Tensor {
})
}

/// Set the tensor's data pointer (useful for mmap-ed data)
///
/// # Safety
///
/// The memory region from `data_ptr` to `data_ptr.offset(tensor.nbytes())` will be read from.
pub unsafe fn set_data(&self, data_ptr: *mut c_void) {
self.with_alive_ctx(|| {
// SAFETY: The with_alive_call guarantees the context is alive
unsafe { *self.ptr.as_ptr() }.data = data_ptr;
})
}
// /// Set the tensor's data pointer (useful for mmap-ed data)
// ///
// /// # Safety
// ///
// /// The memory region from `data_ptr` to `data_ptr.offset(tensor.nbytes())` will be read from.
// pub unsafe fn set_data(&self, data_ptr: *mut c_void) {
// self.with_alive_ctx(|| {
// // SAFETY: The with_alive_call guarantees the context is alive
// unsafe { *self.ptr.as_ptr() }.data = data_ptr;
// })
// }

/// Number of elements in this tensor.
pub fn nelements(&self) -> usize {
Expand Down

0 comments on commit 91a140b

Please sign in to comment.