diff --git a/crates/ggml/src/tensor.rs b/crates/ggml/src/tensor.rs index 09366e71..33d7114c 100644 --- a/crates/ggml/src/tensor.rs +++ b/crates/ggml/src/tensor.rs @@ -220,6 +220,11 @@ impl Tensor { sys::opencl::ggml_cl_free_data(self.ptr.as_ptr()); } } + + /// Returns true if this tensor is stored contiguously in memory + pub fn is_contiguous(&self) -> bool { + unsafe { sys::ggml_is_contiguous(self.ptr.as_ptr()) } + } } impl Tensor { fn with_alive_ctx(&self, mut f: impl FnMut() -> U) -> U {