pub fn infer_forward_concrete(
    op: &dyn Op,
    inputs: &Vec<&InferenceFact>,
) -> TractResult<Option<TVec<InferenceFact>>> {
    let input_values: TVec<_> =
        inputs.iter().filter_map(|t| t.value.concretize()).map(|v| v.clone().into()).collect();

    if input_values.len() < inputs.len() {
        debug!("Can't infer value: some inputs are still unknown.");
        return Ok(None);
    }

    // If we know the value of all the inputs, we can deduce everything.
    if op.is_stateless() {
        let output_value = op.eval(input_values)?.pop().unwrap();
        return Ok(Some(tvec![output_value.into()]));
    }

    Ok(None)
}
/// Infers every possible fact when all the values are concrete.
Infers every possible fact when all the values are concrete.
Infers every possible fact when all the values are concrete .
pub fn infer_forward_concrete(
    op: &dyn Op,
    inputs: &Vec<&InferenceFact>,
) -> TractResult<Option<TVec<InferenceFact>>> {
    let input_values: TVec<_> =
        inputs.iter().filter_map(|t| t.value.concretize()).map(|v| v.clone().into()).collect();
    if input_values.len() < inputs.len() {
        debug!("Can't infer value: some inputs are still unknown.");
        return Ok(None);
    }
    // If we know the value of all the inputs, we can deduce everything.
    if op.is_stateless() {
        let output_value = op.eval(input_values)?.pop().unwrap();
        return Ok(Some(tvec![output_value.into()]));
    }
    Ok(None)
}
pub fn infer_forward_concrete ( op : & dyn Op , inputs : & Vec < & InferenceFact > , ) -> TractResult < Option < TVec < InferenceFact > > > { let input_values : TVec < _ > = inputs . iter ( ) . filter_map ( | t | t . value . concretize ( ) ) . map ( | v | v . clone ( ) . into ( ) ) . collect ( ) ; if input_values . len ( ) < inputs . len ( ) { debug ! ( " " ) ; return Ok ( None ) ; } // If we know the value of all the inputs, we can deduce everything. if op . is_stateless ( ) { let output_value = op . eval ( input_values ) ? . pop ( ) . unwrap ( ) ; return Ok ( Some ( tvec ! [ output_value into ( ) ] ) ) ; } Ok ( None ) }
Infers every possible fact when all the values are concrete.
Infers every possible fact when all the values are concrete .
op
&dyn Op
inputs
&Vec<&InferenceFact>
op
&dyn Op
inputs
&Vec<&InferenceFact>