Struct caffe2_graph::Graph

source ·
pub struct Graph { /* private fields */ }
Expand description

| Graph representation of a Netdef. |

Implementations§

source§

impl Graph

source

pub fn size(&self) -> usize

source

pub fn push_node(&mut self, new_node: &Node)

source

pub fn resize_nodes(&mut self, new_size: usize)

source

pub fn node<'a>(&'a self, idx: usize) -> &'a Node

| Index safe, less verbose way to access | nodes |

source

pub fn node_mut<'a>(&'a mut self, idx: usize) -> &'a mut Node

source

pub fn is_node_active(&mut self, idx: usize) -> bool

source

pub fn external_input(&self) -> &HashSet<String>

source

pub fn external_output(&self) -> &HashSet<String>

source

pub fn new(net: &NetDef) -> Self

| Graph generation. | | Given a netdef, returns a Graph. | | Each node represents an operator. | | An edge exists between two nodes if the | parent op writes to a blob, which is the | input of the child blob, with no other | op writing to the blob in between the | execution order. | | Time Complexity: O(E), where E is the | number of blobs |

source

pub fn get_subgraph_input(&mut self, match_: &Vec<i32>) -> Vec<(String, i32)>

| Given a subgraph, gets all of the parents | of the subgraph, as well as their associated | blob names. Sorted by blob names. | | <string, int> := (name of blob writing | into subgraph, index of node that writes | into subgraph using that blob) |

source

pub fn get_subgraph_output(&mut self, match_: &Vec<i32>) -> Vec<(String, i32)>

| Given a subgraph, gets all of the children | of the subgraph, as well as their associated | blob names. Sorted by blob names. | | <string, int> := (name of blob reading | from subgraph, index of node that reads | from subgraph using that blob) |

source

pub fn get_subgraph_perimeter_helper( &mut self, from_children: bool, match_: &Vec<i32> ) -> Vec<(String, i32)>

| This helper function will either get: | | 1) a list for the blobs that write INTO | a subgraph | | 2) a list of for the blobs that are written | FROM a subgraph. | | The “from_children” flag determines | if it is case 1 (true) or case 2 (false). |

source

pub fn get_net_def(&mut self) -> NetDef

| Generates a NetDef Representation | for the current graph. | | Nodes are visited in topological order, | which is proper Opdef ordering. | | TODO(benz): | | There exists conflicts with repeated | blob names, where topological sorting | is not sufficient for correct netdef | representation, unless blobs are renamed. | | For example, if after a transformation, | We have operator ancestry: | | A –> B –> C, and also A –> D –> E, where | B -> C and D -> E uses the same blob name, | then A, B, D, E, C is a correct topological | ordering, but D will write to the blob | that C reads from, instead of B. | | Currently believe that there will always | be ambiguity unless blobs are renamed. | | This is solved by performing SSA on all | transformed blob names. |

source

pub fn deactivate_subgraph(&mut self, subgraph: Vec<i32>)

| Deactivate a subgraph, and get rid of | all edges into this subgraph. |

Auto Trait Implementations§

§

impl RefUnwindSafe for Graph

§

impl Send for Graph

§

impl Sync for Graph

§

impl Unpin for Graph

§

impl UnwindSafe for Graph

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for Twhere T: Send,