pub struct ModuleField<'a, F1, F2, Mod, Field>where
    F1: FnMut(&Mod) -> &Field,
    F2: FnMut(&mut Mod) -> &mut Field,{ /* private fields */ }
Expand description

A ModuleFields that represents a field that contains one or more Tensors.

Trait Implementations§

source§

impl<'a, F1, F2, E: Dtype, D: Device<E>, Mod: TensorCollection<E, D>, Field> ModuleFields<Mod, E, D> for ModuleField<'a, F1, F2, Mod, Field>where F1: FnMut(&Mod) -> &Field, F2: FnMut(&mut Mod) -> &mut Field, Field: TensorCollection<E, D>,

§

type Options<E2: Dtype, D2: Device<E2>> = Option<<Field as TensorCollection<E, D>>::To<E2, D2>>

A list of optional instances of each field,
§

type Output<E2: Dtype, D2: Device<E2>> = <Field as TensorCollection<E, D>>::To<E2, D2>

A list of instances of each field,
source§

fn visit_fields<V: ModuleVisitor<Mod, E, D>>( self, visitor: &mut V ) -> Result<Self::Options<V::E2, V::D2>, V::Err>

Calls ModuleVisitor::visit_module or ModuleVisitor::visit_tensor for each field, and returns optionally constructed fields
source§

fn handle_options<E2: Dtype, D2: Device<E2>>( options: Self::Options<E2, D2> ) -> Option<Self::Output<E2, D2>>

If any optional fields are None, returns None. Otherwise returns instances of all fields.

Auto Trait Implementations§

§

impl<'a, F1, F2, Mod, Field> RefUnwindSafe for ModuleField<'a, F1, F2, Mod, Field>where F1: RefUnwindSafe, F2: RefUnwindSafe, Field: RefUnwindSafe, Mod: RefUnwindSafe,

§

impl<'a, F1, F2, Mod, Field> Send for ModuleField<'a, F1, F2, Mod, Field>where F1: Send, F2: Send, Field: Send, Mod: Send,

§

impl<'a, F1, F2, Mod, Field> Sync for ModuleField<'a, F1, F2, Mod, Field>where F1: Sync, F2: Sync, Field: Sync, Mod: Sync,

§

impl<'a, F1, F2, Mod, Field> Unpin for ModuleField<'a, F1, F2, Mod, Field>where F1: Unpin, F2: Unpin, Field: Unpin, Mod: Unpin,

§

impl<'a, F1, F2, Mod, Field> UnwindSafe for ModuleField<'a, F1, F2, Mod, Field>where F1: UnwindSafe, F2: UnwindSafe, Field: UnwindSafe, Mod: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V