Struct tract_tensorflow::tfpb::tensorflow::NodeDef[][src]

pub struct NodeDef {
    pub name: String,
    pub op: String,
    pub input: Vec<String>,
    pub device: String,
    pub attr: HashMap<String, AttrValue>,
}

Fields

name: String

The name given to this operator. Used for naming inputs, logging, visualization, etc. Unique within a single GraphDef. Must match the regexp “[A-Za-z0-9.][A-Za-z0-9_./]*”.

op: String

The operation name. There may be custom parameters in attrs. Op names starting with an underscore are reserved for internal use.

input: Vec<String>

Each input is “node:src_output” with “node” being a string name and “src_output” indicating which output tensor to use from “node”. If “src_output” is 0 the “:0” suffix can be omitted. Regular inputs may optionally be followed by control inputs that have the format “^node”.

device: String

A (possibly partial) specification for the device on which this node should be placed. The expected syntax for this string is as follows:

DEVICE_SPEC ::= PARTIAL_SPEC

PARTIAL_SPEC ::= (“/” CONSTRAINT) * CONSTRAINT ::= (“job:” JOB_NAME) | (“replica:” [1-9][0-9]) | (“task:” [1-9][0-9]) | (“device:” [A-Za-z]* “:” ([1-9][0-9]* | “*”) )

Valid values for this string include:

  • “/job:worker/replica:0/task:1/device:GPU:3” (full specification)
  • “/job:worker/device:GPU:3” (partial specification)
  • “” (no specification)

If the constraints do not resolve to a single device (or if this field is empty or not present), the runtime will attempt to choose a device automatically.

attr: HashMap<String, AttrValue>

Operation-specific graph-construction-time configuration. Note that this should include all attrs defined in the corresponding OpDef, including those with a value matching the default – this allows the default to change and makes NodeDefs easier to interpret on their own. However, if an attr with a default is not specified in this list, the default will be used. The “names” (keys) must match the regexp “[a-z][a-z0-9_]+” (and one of the names from the corresponding OpDef’s attr field). The values must have a type matching the corresponding OpDef attr’s type field. TODO(josh11b): Add some examples here showing best practices.

Implementations

impl NodeDef[src]

pub fn name<S: ToString>(self, n: S) -> NodeDef[src]

pub fn op<S: ToString>(self, n: S) -> NodeDef[src]

pub fn input<S: ToString>(self, n: S) -> NodeDef[src]

pub fn attr<S: ToString, V: Into<AttrValue>>(self, n: S, v: V) -> NodeDef[src]

impl NodeDef[src]

pub fn get_attr_raw_str(&self, name: &str) -> TractResult<&[u8]>[src]

pub fn get_attr_opt_raw_str(&self, name: &str) -> TractResult<Option<&[u8]>>[src]

pub fn get_attr_str(&self, name: &str) -> TractResult<String>[src]

pub fn get_attr_opt_str(&self, name: &str) -> TractResult<Option<String>>[src]

pub fn get_attr_bool(&self, name: &str) -> TractResult<bool>[src]

pub fn get_attr_opt_bool(&self, name: &str) -> TractResult<Option<bool>>[src]

pub fn get_attr_datum_type(&self, name: &str) -> TractResult<DatumType>[src]

pub fn get_attr_opt_datum_type(
    &self,
    name: &str
) -> TractResult<Option<DatumType>>
[src]

pub fn get_attr_shape(&self, name: &str) -> TractResult<TVec<isize>>[src]

pub fn get_attr_opt_shape(&self, name: &str) -> TractResult<Option<TVec<isize>>>[src]

pub fn get_attr_tensor(&self, name: &str) -> TractResult<Tensor>[src]

pub fn get_attr_opt_tensor(&self, name: &str) -> TractResult<Option<Tensor>>[src]

pub fn get_attr_int<T: FromPrimitive>(&self, name: &str) -> TractResult<T>[src]

pub fn get_attr_opt_int<T: FromPrimitive>(
    &self,
    name: &str
) -> TractResult<Option<T>>
[src]

pub fn get_attr_float<T: FromPrimitive>(&self, name: &str) -> TractResult<T>[src]

pub fn get_attr_opt_float<T: FromPrimitive>(
    &self,
    name: &str
) -> TractResult<Option<T>>
[src]

pub fn get_attr_list_int<T: FromPrimitive>(
    &self,
    name: &str
) -> TractResult<Vec<T>>
[src]

pub fn get_attr_opt_list_int<T: FromPrimitive>(
    &self,
    name: &str
) -> TractResult<Option<Vec<T>>>
[src]

Trait Implementations

impl Clone for NodeDef[src]

fn clone(&self) -> NodeDef[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for NodeDef[src]

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

Formats the value using the given formatter. Read more

impl Default for NodeDef[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl Message for NodeDef[src]

fn encode_raw<B>(&self, buf: &mut B) where
    B: BufMut
[src]

fn merge_field<B>(
    &mut self,
    tag: u32,
    wire_type: WireType,
    buf: &mut B,
    ctx: DecodeContext
) -> Result<(), DecodeError> where
    B: Buf
[src]

fn encoded_len(&self) -> usize[src]

Returns the encoded length of the message without a length delimiter.

fn clear(&mut self)[src]

Clears the message, resetting all fields to their default.

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
    B: BufMut
[src]

Encodes the message to a buffer. Read more

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
    B: BufMut
[src]

Encodes the message with a length-delimiter to a buffer. Read more

fn decode<B>(buf: B) -> Result<Self, DecodeError> where
    Self: Default,
    B: Buf
[src]

Decodes an instance of the message from a buffer. Read more

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
    Self: Default,
    B: Buf
[src]

Decodes a length-delimited instance of the message from the buffer.

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError> where
    B: Buf
[src]

Decodes an instance of the message from a buffer, and merges it into self. Read more

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError> where
    B: Buf
[src]

Decodes a length-delimited instance of the message from buffer, and merges it into self. Read more

impl PartialEq<NodeDef> for NodeDef[src]

fn eq(&self, other: &NodeDef) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &NodeDef) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for NodeDef[src]

Auto Trait Implementations

impl RefUnwindSafe for NodeDef

impl Send for NodeDef

impl Sync for NodeDef

impl Unpin for NodeDef

impl UnwindSafe for NodeDef

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast for T where
    T: Any

pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    F: Future + Unpin + ?Sized,
    A: Allocator + 'static, 
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    I: Iterator + ?Sized,
    A: Allocator
type Item = <I as Iterator>::Item;

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

pub fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

impl<T> DowncastSync for T where
    T: Any + Send + Sync

pub fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + 'static + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

impl<T> DynClone for T where
    T: Clone
[src]

pub fn __clone_box(&self, Private) -> *mut ()[src]

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.