pub struct RecurrentTracker<T: Inferer> { /* private fields */ }Expand description
The RecurrentTracker wraps an inferer to manage states that
are input/output in a recurrent fashion, instead of roundtripping
them to the high-level code.
Implementations§
Source§impl<T> RecurrentTracker<T>where
T: Inferer,
impl<T> RecurrentTracker<T>where
T: Inferer,
Sourcepub fn wrap(inferer: T) -> Result<RecurrentTracker<T>>
pub fn wrap(inferer: T) -> Result<RecurrentTracker<T>>
Wraps the provided inferer to automatically track any keys that are both inputs/outputs.
Sourcepub fn new(inferer: T, info: Vec<RecurrentInfo>) -> Result<Self>
pub fn new(inferer: T, info: Vec<RecurrentInfo>) -> Result<Self>
Create a new recurrency tracker for the model.
Trait Implementations§
Source§impl<T> Inferer for RecurrentTracker<T>where
T: Inferer,
impl<T> Inferer for RecurrentTracker<T>where
T: Inferer,
Source§fn select_batch_size(&self, max_count: usize) -> usize
fn select_batch_size(&self, max_count: usize) -> usize
Query the inferer for how many elements it can deal with in a single batch.
Source§fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
Execute the model on the provided pre-batched data.
Source§fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model inputs.
Source§fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model outputs.
Source§fn input_shapes(&self) -> &[(String, Vec<usize>)]
fn input_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model inputs. This API
only contains the external API, so code-based transforms
outside the model are hidden.
Source§fn output_shapes(&self) -> &[(String, Vec<usize>)]
fn output_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model outputs. This API
only contains the external API, so code-based transforms
outside the model are hidden.
fn begin_agent(&self, id: u64)
fn end_agent(&self, id: u64)
Auto Trait Implementations§
impl<T> !Freeze for RecurrentTracker<T>
impl<T> !RefUnwindSafe for RecurrentTracker<T>
impl<T> Send for RecurrentTracker<T>where
T: Send,
impl<T> Sync for RecurrentTracker<T>where
T: Sync,
impl<T> Unpin for RecurrentTracker<T>where
T: Unpin,
impl<T> UnwindSafe for RecurrentTracker<T>where
T: 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> InfererExt for Twhere
T: Inferer,
impl<T> InfererExt for Twhere
T: Inferer,
Source§fn with_default_epsilon(self, key: &str) -> Result<EpsilonInjector<Self>>
fn with_default_epsilon(self, key: &str) -> Result<EpsilonInjector<Self>>
Add an epsilon injector using the default noise kind.
Source§fn with_epsilon<G: NoiseGenerator>(
self,
generator: G,
key: &str,
) -> Result<EpsilonInjector<Self, G>>
fn with_epsilon<G: NoiseGenerator>( self, generator: G, key: &str, ) -> Result<EpsilonInjector<Self, G>>
Add an epsilon injector with a specific noise generator.
Source§fn into_batched(self) -> Batched<Self>
fn into_batched(self) -> Batched<Self>
Wrap in a batching interface.
Source§fn infer(
&mut self,
observations: HashMap<u64, State<'_>>,
) -> Result<HashMap<u64, Response<'_>>, Error>
fn infer( &mut self, observations: HashMap<u64, State<'_>>, ) -> Result<HashMap<u64, Response<'_>>, Error>
👎Deprecated since 0.3.0: Please use the more explicit ‘infer_batch’ instead.
Execute the model on the provided batch of elements.
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more