pub struct TensorField<'a, F1, F2, Mod, S: Shape, E: Dtype, D: Device<E>>where
    F1: FnMut(&Mod) -> &Tensor<S, E, D>,
    F2: FnMut(&mut Mod) -> &mut Tensor<S, E, D>,{ /* private fields */ }
Expand description

A ModuleFields that represents a field that contains a single Tensor.

Trait Implementations§

source§

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

§

type Options<E2: Dtype, D2: Device<E2>> = Option<Tensor<S, E2, D2, NoneTape>>

A list of optional instances of each field,
§

type Output<E2: Dtype, D2: Device<E2>> = Tensor<S, E2, D2, NoneTape>

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, S, E, D> RefUnwindSafe for TensorField<'a, F1, F2, Mod, S, E, D>where F1: RefUnwindSafe, F2: RefUnwindSafe, Mod: RefUnwindSafe, S: RefUnwindSafe,

§

impl<'a, F1, F2, Mod, S, E, D> Send for TensorField<'a, F1, F2, Mod, S, E, D>where F1: Send, F2: Send, Mod: Send,

§

impl<'a, F1, F2, Mod, S, E, D> Sync for TensorField<'a, F1, F2, Mod, S, E, D>where F1: Sync, F2: Sync, Mod: Sync,

§

impl<'a, F1, F2, Mod, S, E, D> Unpin for TensorField<'a, F1, F2, Mod, S, E, D>where F1: Unpin, F2: Unpin, Mod: Unpin, S: Unpin,

§

impl<'a, F1, F2, Mod, S, E, D> UnwindSafe for TensorField<'a, F1, F2, Mod, S, E, D>where F1: UnwindSafe, F2: UnwindSafe, Mod: UnwindSafe, S: 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