Struct dfdx::nn::tensor_collection::TensorField
source · 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>,
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>>
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>
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>
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
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> 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