[−][src]Struct autograd::Eval
Helper structure for batched evaluation.
Eval
structure can buffer evaluation targets with useful push
and extend
functions
and runs batched evaluation.
Use this in case Tensor::eval
or Graph::eval doesn't help.
use autograd as ag; use ndarray; ag::with(|g| { let a = g.placeholder(&[]); let x = a + a; let y = a * a; let z = a / a; ag::Eval::new(g) .push(&x) .extend(&[y, z]) .feed(&[a.given(ndarray::arr0(2.).view())]) .run(); // Do eval });
Implementations
impl<'feed, 'tensor, 'view, 'graph, F: Float> Eval<'view, 'feed, 'graph, F>
[src]
pub fn new(scope: &'graph Graph<F>) -> Self
[src]
Instantiates a new evaluation session.
pub fn push<A>(&mut self, x: A) -> &mut Self where
A: AsRef<Tensor<'graph, F>>,
[src]
A: AsRef<Tensor<'graph, F>>,
Appends a tensor to the back of the evaluation targets.
pub fn feed(&mut self, feeds: &'feed [Feed<'view, F>]) -> &mut Self
[src]
feeds
is a sequence of (placeholder-tensor, its value)
pub fn extend<A>(&mut self, xs: &'tensor [A]) -> &mut Self where
A: AsRef<Tensor<'graph, F>>,
[src]
A: AsRef<Tensor<'graph, F>>,
Extends the evaluation targets with xs
.
pub fn run(&'tensor self) -> Vec<Result<NdArray<F>, EvalError>>
[src]
Evaluates the buffered tensors.
Auto Trait Implementations
impl<'view, 'feed, 'graph, F> !RefUnwindSafe for Eval<'view, 'feed, 'graph, F>
impl<'view, 'feed, 'graph, F> !Send for Eval<'view, 'feed, 'graph, F>
impl<'view, 'feed, 'graph, F> !Sync for Eval<'view, 'feed, 'graph, F>
impl<'view, 'feed, 'graph, F> Unpin for Eval<'view, 'feed, 'graph, F> where
'view: 'feed,
'view: 'feed,
impl<'view, 'feed, 'graph, F> !UnwindSafe for Eval<'view, 'feed, 'graph, F>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,