pub fn analyse_obstinate(&mut self, obstinate: bool) -> TractResult<()> {
        let mut nodes_to_visit: BTreeSet<usize> =
            self.model.borrow().eval_order()?.iter().cloned().collect();
        let mut first_error = None;
        loop {
            trace!("Remaining nodes {}", nodes_to_visit.len());
            let node = match nodes_to_visit.iter().next() {
                None => break,
                Some(n) => *n,
            };
            match self.analyse_one(node) {
                Ok(changed_edges) => {
                    for (edge, _fact) in changed_edges {
                        trace!("Changed edge: {:?}", edge);
                        for dst in self.model.borrow().nodes()[edge.node].outputs[edge.slot]
                            .successors
                            .iter()
                        {
                            if dst.node != edge.node {
                                trace!("Inserting node dn {:?}", dst.node);
                                nodes_to_visit.insert(dst.node);
                            }
                        }
                        if edge.node != node {
                            trace!("Inserting node up {}", edge.node);
                            nodes_to_visit.insert(edge.node);
                        }
                    }
                }
                Err(e) => {
                    let e = format!("Analysing node {:?}, {:?}", node, e);
                    if !obstinate {
                        return Err(e.into());
                    }
                    debug!("{:?}", e);
                    if first_error.is_none() {
                        first_error = Some(e);
                    }
                }
            }
            nodes_to_visit.remove(&node);
        }
        trace!("analyse done");
        if let Some(e) = first_error {
            Err(e)?
        }
        Ok(())
    }
/// Runs the entire analysis at once. Will not stop on error if obstinate is
/// true.
Runs the entire analysis at once. Will not stop on error if obstinate is
true.
Runs the entire analysis at once . Will not stop on error if obstinate is true .
pub fn analyse_obstinate(&mut self, obstinate: bool) -> TractResult<()> {
        let mut nodes_to_visit: BTreeSet<usize> =
            self.model.borrow().eval_order()?.iter().cloned().collect();
        let mut first_error = None;
        loop {
            trace!("Remaining nodes {}", nodes_to_visit.len());
            let node = match nodes_to_visit.iter().next() {
                None => break,
                Some(n) => *n,
            };
            match self.analyse_one(node) {
                Ok(changed_edges) => {
                    for (edge, _fact) in changed_edges {
                        trace!("Changed edge: {:?}", edge);
                        for dst in self.model.borrow().nodes()[edge.node].outputs[edge.slot]
                            .successors
                            .iter()
                        {
                            if dst.node != edge.node {
                                trace!("Inserting node dn {:?}", dst.node);
                                nodes_to_visit.insert(dst.node);
                            }
                        }
                        if edge.node != node {
                            trace!("Inserting node up {}", edge.node);
                            nodes_to_visit.insert(edge.node);
                        }
                    }
                }
                Err(e) => {
                    let e = format!("Analysing node {:?}, {:?}", node, e);
                    if !obstinate {
                        return Err(e.into());
                    }
                    debug!("{:?}", e);
                    if first_error.is_none() {
                        first_error = Some(e);
                    }
                }
            }
            nodes_to_visit.remove(&node);
        }
        trace!("analyse done");
        if let Some(e) = first_error {
            Err(e)?
        }
        Ok(())
    }
pub fn analyse_obstinate ( & mut self , obstinate : bool ) -> TractResult < ( ) > { let mut nodes_to_visit : BTreeSet < usize > = self . model . borrow ( ) . eval_order ( ) ? . iter ( ) . cloned ( ) . collect ( ) ; let mut first_error = None ; loop { trace ! ( " " nodes_to_visit len ( ) ) ; let node = match nodes_to_visit . iter ( ) . next ( ) { None => break , Some ( n ) => * n , } ; match self . analyse_one ( node ) { Ok ( changed_edges ) => { for ( edge , _fact ) in changed_edges { trace ! ( " " edge ) ; for dst in self . model . borrow ( ) . nodes ( ) [ edge . node ] . outputs [ edge . slot ] . successors . iter ( ) { if dst . node != edge . node { trace ! ( " " dst node ) ; nodes_to_visit . insert ( dst . node ) ; } } if edge . node != node { trace ! ( " " edge node ) ; nodes_to_visit . insert ( edge . node ) ; } } } Err ( e ) => { let e = format ! ( " " node e ) ; if ! obstinate { return Err ( e . into ( ) ) ; } debug ! ( " " e ) ; if first_error . is_none ( ) { first_error = Some ( e ) ; } } } nodes_to_visit . remove ( & node ) ; } trace ! ( " " ) ; if let Some ( e ) = first_error { Err ( e ) ? } Ok ( ( ) ) }
Runs the entire analysis at once.
Runs the entire analysis at once .
&mut self
obstinate
bool
&mut self
obstinate
bool