Skip to main content

Weights

Struct Weights 

Source
#[repr(C)]
pub struct Weights { pub type_: DataType, pub values: *const c_void, pub count: i64, }
Expand description

Weights

An array of weights used as a layer parameter.

When using the DLA, the cumulative size of all Weights used in a network must be less than 512MB in size. If the build option kGPU_FALLBACK is specified, then multiple DLA sub-networks may be generated from the single original network.

The weights are held by reference until the engine has been built. Therefore the data referenced by values field should be preserved until the build is complete.

The term “empty weights” refers to Weights with weight coefficients ( count == 0 and values == nullptr).

Fields§

§type_: DataType

< The type of the weights.

§values: *const c_void

< The weight values, in a contiguous array.

§count: i64

< The number of weights in the array.

Implementations§

Source§

impl Weights

Helper methods for Weights construction

Source

pub fn new_float(values_ptr: *const c_void, count_val: i64) -> Self

Create a Weights with FLOAT data type

Source

pub fn new_with_type( data_type: DataType, values_ptr: *const c_void, count_val: i64, ) -> Self

Create a Weights with specified data type

Trait Implementations§

Source§

impl CopyNew for Weights

Source§

unsafe fn copy_new(other: &Weights, this: Pin<&mut MaybeUninit<Weights>>)

Synthesized copy constructor.

Source§

impl Drop for Weights

Source§

fn drop(self: &mut Weights)

Synthesized destructor.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl ExternType for Weights

Source§

type Id = (n, v, i, n, f, e, r, _1, (), W, e, i, g, h, t, s)

A type-level representation of the type’s C++ namespace and type name. Read more
Source§

type Kind = Trivial

Source§

impl MakeCppStorage for Weights

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut Weights

Allocates heap space for this type in C++ and return a pointer to that space, but do not initialize that space (i.e. do not yet call a constructor). Read more
Source§

unsafe fn free_uninitialized_cpp_storage(arg0: *mut Weights)

Frees a C++ allocation which has not yet had a constructor called. Read more
Source§

impl MoveNew for Weights

Source§

unsafe fn move_new( other: Pin<MoveRef<'_, Weights>>, this: Pin<&mut MaybeUninit<Weights>>, )

Synthesized move constructor.

Source§

impl SharedPtrTarget for Weights

Source§

impl UniquePtrTarget for Weights

Source§

impl VectorElement for Weights

Source§

impl WeakPtrTarget for Weights

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithinBoxTrivial for T
where T: ExternType<Kind = Trivial> + Unpin,

Source§

fn within_box(self) -> Pin<Box<T>>

Source§

impl<T> WithinUniquePtrTrivial for T
where T: UniquePtrTarget + ExternType<Kind = Trivial> + Unpin,