Struct caffe2_graph::Graph
source · pub struct Graph { /* private fields */ }
Expand description
| Graph representation of a Netdef. |
Implementations§
source§impl Graph
impl Graph
pub fn size(&self) -> usize
pub fn push_node(&mut self, new_node: &Node)
pub fn resize_nodes(&mut self, new_size: usize)
sourcepub fn node<'a>(&'a self, idx: usize) -> &'a Node
pub fn node<'a>(&'a self, idx: usize) -> &'a Node
| Index safe, less verbose way to access | nodes |
pub fn node_mut<'a>(&'a mut self, idx: usize) -> &'a mut Node
pub fn is_node_active(&mut self, idx: usize) -> bool
pub fn external_input(&self) -> &HashSet<String>
pub fn external_output(&self) -> &HashSet<String>
sourcepub fn new(net: &NetDef) -> Self
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 |
sourcepub fn get_subgraph_input(&mut self, match_: &Vec<i32>) -> Vec<(String, i32)>
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) |
sourcepub fn get_subgraph_output(&mut self, match_: &Vec<i32>) -> Vec<(String, i32)>
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) |
sourcepub fn get_subgraph_perimeter_helper(
&mut self,
from_children: bool,
match_: &Vec<i32>
) -> Vec<(String, i32)>
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). |
sourcepub fn get_net_def(&mut self) -> NetDef
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. |
sourcepub fn deactivate_subgraph(&mut self, subgraph: Vec<i32>)
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§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.