[][src]Struct autograd::Eval

pub struct Eval<'view, 'feed, 'graph, F: Float> { /* fields omitted */ }

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]

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]

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, 

impl<'view, 'feed, 'graph, F> !UnwindSafe for Eval<'view, 'feed, 'graph, F>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,