Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ impl DLPackTensor {
&self.raw.as_ref().dl_tensor
}
}

/// Consumes the `DLPackTensor`, returning the underlying raw pointer.
///
/// # Safety
///
/// The caller is responsible for managing the memory and calling the deleter
/// when the tensor is no longer needed.
pub fn into_raw(self) -> NonNull<sys::DLManagedTensorVersioned>{
let raw = self.raw;
// forget so Drop and ergo the deleter are not called
std::mem::forget(self);
return raw;
}
}

/// A reference to a DLPack tensor, with data borrowed from some owner,
Expand Down
Loading