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