[][src]Struct tensorflow::SessionRunArgs

pub struct SessionRunArgs<'l> { /* fields omitted */ }

Manages the inputs and outputs for a single execution of a graph.

Typical usage involves creating an instance of this struct, adding some inputs to it, requesting some outputs, passing it to Session::run and then taking the outputs out of it.

Example:

This example is not tested
let mut args = SessionRunArgs::new();
args.add_feed(&op1, 0, &tensor1);
args.add_feed(&op2, 0, &tensor2);
let result_token = args.request_fetch(&op3, 0);
session.run(&mut args)?;
let result_tensor = args.fetch(result_token)?;

See examples/addition.rs for a more concrete example.

Methods

impl<'l> SessionRunArgs<'l>[src]

pub fn new() -> Self[src]

Creates a SessionRunArgs.

pub fn add_feed<T: TensorType>(
    &mut self,
    operation: &Operation,
    index: c_int,
    tensor: &'l Tensor<T>
)
[src]

Adds an input to be fed to the graph. The index selects which output of the operation to feed. For most operations, there is only one output, so the index should be 0.

pub fn add_input<T: TensorType>(
    &mut self,
    operation: &Operation,
    index: c_int,
    tensor: &'l Tensor<T>
)
[src]

Deprecated since 0.10.0:

Use add_feed instead.

Deprecated alias for add_feed.

pub fn request_fetch(
    &mut self,
    operation: &Operation,
    index: c_int
) -> FetchToken
[src]

Requests that an output is fetched from the graph after running this step. The index selects which output of the operation to return. For most operations, there is only one output, so the index should be 0. Returns a token that you can then use to fetch this output from the args after running it.

pub fn request_output(
    &mut self,
    operation: &Operation,
    index: c_int
) -> OutputToken
[src]

Deprecated since 0.10.0:

Use request_fetch instead.

Deprecated alias for request_fetch.

pub fn fetch<T: TensorType>(&mut self, token: FetchToken) -> Result<Tensor<T>>[src]

Extracts a tensor output given a token. A given token can only be extracted once per Session::run. Returns an error if the token is invalid, output is unavailable or the requested type does not match the type of the actual tensor.

pub fn take_output<T: TensorType>(
    &mut self,
    token: OutputToken
) -> Result<Tensor<T>>
[src]

Deprecated since 0.10.0:

Use fetch instead.

Deprecated alias for fetch.

pub fn add_target(&mut self, operation: &Operation)[src]

Adds a target operation to be executed when running the graph.

pub fn output_data_type(&self, output_idx: usize) -> Option<DataType>[src]

Retuns the type of the tensor given an index. Returns None if the index is out of range or the output is not yet available.

Trait Implementations

impl<'l> Drop for SessionRunArgs<'l>[src]

impl<'l> Debug for SessionRunArgs<'l>[src]

Auto Trait Implementations

impl<'l> !Send for SessionRunArgs<'l>

impl<'l> !Sync for SessionRunArgs<'l>

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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<T> Any for T where
    T: 'static + ?Sized
[src]