Skip to main content

GraphLayer

Struct GraphLayer 

Source
pub struct GraphLayer<'net> { /* private fields */ }
Expand description

A layer a loaded graph owns, borrowed for native calls.

Net::layer_handle builds one for an index the graph loaded. The native layer belongs to the network and stays valid until the graph is cleared or reloaded, while this value owns only the C handle around it, which releases on drop and never destroys the layer. The borrow of the network keeps the layer alive for as long as the handle exists. A registered custom layer keeps its userdata, so a native call that rewrites userdata breaks the registration.

Implementations§

Source§

impl<'net> GraphLayer<'net>

Source

pub fn as_raw(&self) -> ncnn_layer_t

Borrows the native layer handle.

The handle is the one the C API expects. Native calls that write through it, or that read a tensor, follow the same rules as the rest of the raw module: the graph stays loaded and no request runs on the network meanwhile.

Trait Implementations§

Source§

impl Drop for GraphLayer<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
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

Auto Trait Implementations§

§

impl<'net> !RefUnwindSafe for GraphLayer<'net>

§

impl<'net> !Send for GraphLayer<'net>

§

impl<'net> !Sync for GraphLayer<'net>

§

impl<'net> !UnwindSafe for GraphLayer<'net>

§

impl<'net> Freeze for GraphLayer<'net>

§

impl<'net> Unpin for GraphLayer<'net>

§

impl<'net> UnsafeUnpin for GraphLayer<'net>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.