pub struct ConstOriginKey {
pub ptr: usize,
pub len: usize,
pub dtype: DType,
}Expand description
Identity of the shared host array a weight Const was built from: the data pointer, the element
count and the dtype of the Arc<[T]> its constructor was handed.
Two Consts on different graphs built from the SAME Arc have the same key, which is what lets a
caller that holds realized device copies of weights recognise a weight it has already uploaded
(ROADMAP row 172). The key alone proves nothing about liveness (a freed allocation’s address can be
reused): use ConstOrigin::pin, which succeeds only while the source Arc is alive, and keep the
returned pin for as long as the key is trusted.
Fields§
§ptr: usizeAddress of the first element of the source array.
len: usizeElement count of the source array.
dtype: DTypeElement dtype of the source array.
Trait Implementations§
Source§impl Clone for ConstOriginKey
impl Clone for ConstOriginKey
impl Copy for ConstOriginKey
Source§impl Debug for ConstOriginKey
impl Debug for ConstOriginKey
impl Eq for ConstOriginKey
Source§impl Hash for ConstOriginKey
impl Hash for ConstOriginKey
Source§impl PartialEq for ConstOriginKey
impl PartialEq for ConstOriginKey
impl StructuralPartialEq for ConstOriginKey
Auto Trait Implementations§
impl Forget for ConstOriginKey
impl Freeze for ConstOriginKey
impl Move for ConstOriginKey
impl RefUnwindSafe for ConstOriginKey
impl Send for ConstOriginKey
impl Sync for ConstOriginKey
impl Unpin for ConstOriginKey
impl UnsafeUnpin for ConstOriginKey
impl UnwindSafe for ConstOriginKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.