Struct tract_tensorflow::tfpb::tensorflow::GraphDef

source ·
pub struct GraphDef {
    pub node: Vec<NodeDef>,
    pub versions: Option<VersionDef>,
    pub version: i32,
    pub library: Option<FunctionDefLibrary>,
}
Expand description

Represents the graph of operations

Fields§

§node: Vec<NodeDef>§versions: Option<VersionDef>

Compatibility versions of the graph. See core/public/version.h for version history. The GraphDef version is distinct from the TensorFlow version, and each release of TensorFlow will support a range of GraphDef versions.

§version: i32
👎Deprecated

Deprecated single version field; use versions above instead. Since all GraphDef changes before “versions” was introduced were forward compatible, this field is entirely ignored.

§library: Option<FunctionDefLibrary>

EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET.

“library” provides user-defined functions.

Naming:

  • library.function.name are in a flat namespace. NOTE: We may need to change it to be hierarchical to support different orgs. E.g., { “/google/nn”, { … }}, { “/google/vision”, { … }} { “/org_foo/module_bar”, { … }} map<string, FunctionDefLib> named_lib;
  • If node[i].op is the name of one function in “library”, node[i] is deemed as a function call. Otherwise, node[i].op must be a primitive operation supported by the runtime.

Function call semantics:

  • The callee may start execution as soon as some of its inputs are ready. The caller may want to use Tuple() mechanism to ensure all inputs are ready in the same time.

  • The consumer of return values may start executing as soon as the return values the consumer depends on are ready. The consumer may want to use Tuple() mechanism to ensure the consumer does not start until all return values of the callee function are ready.

Implementations§

source§

impl GraphDef

source

pub fn node(self, n: NodeDef) -> Self

source

pub fn write_to_bytes(&self) -> TractResult<Vec<u8>>

source

pub fn save_to<P: AsRef<Path>>(self, p: P) -> TractResult<()>

Trait Implementations§

source§

impl Clone for GraphDef

source§

fn clone(&self) -> GraphDef

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for GraphDef

source§

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

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

impl Default for GraphDef

source§

fn default() -> Self

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

impl Framework<GraphDef, Graph<InferenceFact, Box<dyn InferenceOp>>> for Tensorflow

source§

fn proto_model_for_path(&self, r: impl AsRef<Path>) -> TractResult<GraphDef>

This method will try to read as frozen model, then as a saved model.

source§

fn proto_model_for_read(&self, r: &mut dyn Read) -> TractResult<GraphDef>

This method expects a frozen model, use open_saved_model for TF2 saved model format.

source§

fn model_for_proto_model_with_symbols( &self, graph: &GraphDef, symbols: &SymbolTable ) -> TractResult<InferenceModel>

Translate a proto model into a model, with some symbols already listed.
source§

fn model_for_proto_model(&self, proto: &ProtoModel) -> Result<Model, Error>

Translate a proto model into a model.
source§

fn model_for_read(&self, r: &mut dyn Read) -> Result<Model, Error>

Read a model from a reader
source§

fn model_for_path(&self, p: impl AsRef<Path>) -> Result<Model, Error>

Build a model from a filename.
source§

impl Message for GraphDef

source§

fn encoded_len(&self) -> usize

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

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

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

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

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

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

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

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

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

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

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

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

impl PartialEq for GraphDef

source§

fn eq(&self, other: &GraphDef) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for GraphDef

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

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

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.
source§

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.
source§

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

source§

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

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

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where 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 T
where 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.