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

Commit

Permalink
add Tensor::is_contiguous
Browse files Browse the repository at this point in the history
`Tensor::is_contiguous`: returns true if this tensor is stored
contiguously in memory
  • Loading branch information
oppiliappan committed Aug 18, 2023
1 parent 129b84a commit 8bab9c5
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 8bab9c5

Please sign in to comment.