pub struct RecursiveWalker<'a, M, F> {
    pub m: M,
    pub f: &'a mut F,
}
Expand description

A standard ModuleVisitor that executes F on every Tensor encountered. F must implement TensorVisitor

Fields§

§m: M§f: &'a mut F

Trait Implementations§

source§

impl<'a, M: Debug, F: Debug> Debug for RecursiveWalker<'a, M, F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, T: TensorCollection<E, D>, E: Dtype, D: Device<E>, F: TensorVisitor<E, D>> ModuleVisitor<T, E, D> for RecursiveWalker<'a, <F::Viewer as TensorViewer>::View<'a, T>, F>

§

type Err = <F as TensorVisitor<E, D>>::Err

§

type E2 = <F as TensorVisitor<E, D>>::E2

§

type D2 = <F as TensorVisitor<E, D>>::D2

source§

fn visit_module<Field, GetRef, GetMut>( &mut self, name: &str, get_refs: GetRef, get_muts: GetMut ) -> Result<Option<Field::To<Self::E2, Self::D2>>, Self::Err>where GetRef: FnMut(&T) -> &Field, GetMut: FnMut(&mut T) -> &mut Field, Field: TensorCollection<E, D>,

Visit a TensorCollection. Do not use this; use visit_fields instead.
source§

fn visit_tensor<S: Shape, GetRef, GetMut>( &mut self, name: &str, get_refs: GetRef, get_muts: GetMut, opts: TensorOptions<S, E, D> ) -> Result<Option<Tensor<S, Self::E2, Self::D2>>, Self::Err>where GetRef: FnMut(&T) -> &Tensor<S, E, D>, GetMut: FnMut(&mut T) -> &mut Tensor<S, E, D>,

Visits an actual named Tensor. Do not use this; use visit_fields instead.
source§

fn visit_scalar<N, GetRef, GetMut>( &mut self, name: &str, get_refs: GetRef, get_muts: GetMut, opts: ScalarOptions<N> ) -> Result<Option<N>, Self::Err>where N: NumCast, GetRef: FnMut(&T) -> &N, GetMut: FnMut(&mut T) -> &mut N,

source§

fn visit_fields<M: ModuleFields<T, E, D>>( &mut self, fields: M, builder: impl FnOnce(M::Output<Self::E2, Self::D2>) -> T::To<Self::E2, Self::D2> ) -> Result<Option<T::To<Self::E2, Self::D2>>, Self::Err>

Takes something that implements ModuleFields and function that takes ModuleFields::Output and returns an instance of T.

Auto Trait Implementations§

§

impl<'a, M, F> RefUnwindSafe for RecursiveWalker<'a, M, F>where F: RefUnwindSafe, M: RefUnwindSafe,

§

impl<'a, M, F> Send for RecursiveWalker<'a, M, F>where F: Send, M: Send,

§

impl<'a, M, F> Sync for RecursiveWalker<'a, M, F>where F: Sync, M: Sync,

§

impl<'a, M, F> Unpin for RecursiveWalker<'a, M, F>where M: Unpin,

§

impl<'a, M, F> !UnwindSafe for RecursiveWalker<'a, M, F>

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
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.
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