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