pub struct Eval<'view, 'feed, 'graph, F: Float> { /* fields omitted */ }
Expand description
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();
});
impl<'feed, 'tensor, 'view, 'graph, F: Float> Eval<'view, 'feed, 'graph, F>
Instantiates a new evaluation session.
Appends a tensor to the back of the evaluation targets.
feeds
is a sequence of (placeholder-tensor, its value)
Extends the evaluation targets with xs
.
Evaluates the buffered tensors.
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>
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,