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

Commit 32925e7

Browse files
committed
Remove ggml::Tensor::set_data
1 parent eab7235 commit 32925e7

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

ggml/src/lib.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -361,17 +361,17 @@ impl Tensor {
361361
})
362362
}
363363

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

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

llama-rs/src/loader.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub(crate) fn load_weights_ggmf_or_unversioned(
173173
byte_size: total_size,
174174
tensor_count: n_tensors.try_into()?,
175175
});
176-
};
176+
}
177177
Ok(())
178178
}
179179

@@ -264,7 +264,6 @@ fn load_tensor_header_ggmf<'a>(
264264
}
265265

266266
fn tensor_type_size(ftype: i32, ne: [i64; 2]) -> Option<usize> {
267-
268267
match ftype {
269268
0 => Some(ggml::type_size(ggml::Type::F32)),
270269
1 => Some(ggml::type_size(ggml::Type::F16)),

0 commit comments

Comments
 (0)