pub struct OperationDescription<'a> { /* private fields */ }
Expand description

An OperationDescription is an Operation in the process of being built (i.e. the builder pattern).

An OperationDescription is required to be finished before the graph goes out of scope, so finish() will be called on drop if it was not already called.

Implementations§

source§

impl<'a> OperationDescription<'a>

source

pub fn finish(self) -> Result<Operation>

Builds the operation and adds it to the graph.

source

pub fn set_device(&mut self, device: &str) -> Result<(), NulError>

Sets the preferred device. The empty string means unconstrained.

source

pub fn add_input<I: Into<Output>>(&mut self, input: I)

Adds an input to this operation.

The index in the port is an index into the source operation’s output array.

source

pub fn add_input_list(&mut self, inputs: &[Output])

Adds multiple inputs to this operation.

The index in the ports is an index into the source operation’s output array.

source

pub fn add_control_input(&mut self, input: &Operation)

Adds a control input.

source

pub fn set_attr_string( &mut self, attr_name: &str, value: &str ) -> Result<(), NulError>

Sets the value of a string attribute.

source

pub fn set_attr_string_list<S: AsRef<str>>( &mut self, attr_name: &str, value: &[S] ) -> Result<(), NulError>

Sets the value of an attribute which holds a list of strings.

source

pub fn set_attr_func_name( &mut self, attr_name: &str, value: &str ) -> Result<(), NulError>

Sets the value of a function attribute.

source

pub fn set_attr_int( &mut self, attr_name: &str, value: i64 ) -> Result<(), NulError>

Sets an int-valued attribute.

source

pub fn set_attr_int_list( &mut self, attr_name: &str, value: &[i64] ) -> Result<(), NulError>

Sets an attribute which holds an array of ints.

source

pub fn set_attr_float( &mut self, attr_name: &str, value: f32 ) -> Result<(), NulError>

Sets a float-valued attribute.

source

pub fn set_attr_float_list( &mut self, attr_name: &str, value: &[f32] ) -> Result<(), NulError>

Sets an attribute which holds an array of floats.

source

pub fn set_attr_bool( &mut self, attr_name: &str, value: bool ) -> Result<(), NulError>

Sets a boolean-valued attribute.

source

pub fn set_attr_bool_list( &mut self, attr_name: &str, value: &[bool] ) -> Result<(), NulError>

Sets an attribute which holds an array of booleans.

source

pub fn set_attr_type( &mut self, attr_name: &str, value: DataType ) -> Result<(), NulError>

Sets a type-valued attribute.

source

pub fn set_attr_type_list( &mut self, attr_name: &str, value: &[DataType] ) -> Result<(), NulError>

Sets an attribute which holds an array of types.

source

pub fn set_attr_shape( &mut self, attr_name: &str, value: &Shape ) -> Result<(), NulError>

Sets a shape-valued attribute.

source

pub fn set_attr_shape_list( &mut self, attr_name: &str, value: &[Shape] ) -> Result<(), NulError>

Sets an attribute which holds an array of shapes.

source

pub fn set_attr_tensor_shape_proto( &mut self, attr_name: &str, value: &[u8] ) -> Result<()>

Sets an attribute with a TensorShapeProto protobuf.

source

pub fn set_attr_tensor_shape_proto_list<T: AsRef<[u8]>>( &mut self, attr_name: &str, value: &[T] ) -> Result<()>

Sets an attribute with an array of TensorShapeProto protobufs.

source

pub fn set_attr_tensor<T: TensorType>( &mut self, attr_name: &str, value: Tensor<T> ) -> Result<()>

Sets a tensor-valued attribute.

source

pub fn set_attr_tensor_list<I, T>( &mut self, attr_name: &str, value: I ) -> Result<()>where I: IntoIterator<Item = Tensor<T>>, T: TensorType,

Sets an attribute which holds an array of tensors.

source

pub fn set_attr_to_attr_value_proto( &mut self, attr_name: &str, value: &[u8] ) -> Result<()>

👎Deprecated since 0.7.0: Use set_attr_value_proto instead.

Sets an attribute with an AttrValue proto.

source

pub fn set_attr_value_proto( &mut self, attr_name: &str, value: &[u8] ) -> Result<()>

Sets an attribute with an AttrValue proto.

Trait Implementations§

source§

impl<'a> Debug for OperationDescription<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Drop for OperationDescription<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.