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

Commit

Permalink
Merge pull request #410 from nerdypepper/add-is-contiguous
Browse files Browse the repository at this point in the history
add `Tensor::is_contiguous`
  • Loading branch information
LLukas22 authored Aug 18, 2023
2 parents 129b84a + 8bab9c5 commit 56e4a35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/ggml/src/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<U>(&self, mut f: impl FnMut() -> U) -> U {
Expand Down

0 comments on commit 56e4a35

Please sign in to comment.