pub fn infer_forward_basic(
    op: &dyn Op,
    inputs: Vec<&InferenceFact>,
) -> TractResult<Option<TVec<InferenceFact>>> {
    if let Some(output) = infer_forward_concrete(op, &inputs)? {
        return Ok(Some(output));
    }

    // Otherwise we can only deduce the type and shape of the output.
    let input_shapes: Vec<_> = inputs.iter().map(|t| &t.shape).collect();

    let datum_type = inputs
        .iter()
        .filter_map(|i| i.datum_type.concretize())
        .next()
        .map(|t| typefact!(t))
        .unwrap_or(typefact!(_));

    let output = InferenceFact {
        datum_type,
        shape: infer_shape_broadcasting(&input_shapes)?.unwrap_or(shapefactoid![..]),
        value: valuefact!(_),
    };

    Ok(Some(tvec![output]))
}
/// Infers basic facts in the case of unary or binary operators.
Infers basic facts in the case of unary or binary operators.
Infers basic facts in the case of unary or binary operators .
pub fn infer_forward_basic(
    op: &dyn Op,
    inputs: Vec<&InferenceFact>,
) -> TractResult<Option<TVec<InferenceFact>>> {
    if let Some(output) = infer_forward_concrete(op, &inputs)? {
        return Ok(Some(output));
    }
    // Otherwise we can only deduce the type and shape of the output.
    let input_shapes: Vec<_> = inputs.iter().map(|t| &t.shape).collect();
    let datum_type = inputs
        .iter()
        .filter_map(|i| i.datum_type.concretize())
        .next()
        .map(|t| typefact!(t))
        .unwrap_or(typefact!(_));
    let output = InferenceFact {
        datum_type,
        shape: infer_shape_broadcasting(&input_shapes)?.unwrap_or(shapefactoid![..]),
        value: valuefact!(_),
    };
    Ok(Some(tvec![output]))
}
pub fn infer_forward_basic ( op : & dyn Op , inputs : Vec < & InferenceFact > , ) -> TractResult < Option < TVec < InferenceFact > > > { if let Some ( output ) = infer_forward_concrete ( op , & inputs ) ? { return Ok ( Some ( output ) ) ; } // Otherwise we can only deduce the type and shape of the output. let input_shapes : Vec < _ > = inputs . iter ( ) . map ( | t | & t . shape ) . collect ( ) ; let datum_type = inputs . iter ( ) . filter_map ( | i | i . datum_type . concretize ( ) ) . next ( ) . map ( | t | typefact ! ( t ) ) . unwrap_or ( typefact ! ( ) ) ; let output = InferenceFact { datum_type , shape : infer_shape_broadcasting ( & input_shapes ) ? . unwrap_or ( shapefactoid ! [ ] ) , value : valuefact ! ( ) , } ; Ok ( Some ( tvec ! [ output ] ) ) }
Infers basic facts in the case of unary or binary operators.
Infers basic facts in the case of unary or binary operators .
op
&dyn Op
inputs
Vec<&InferenceFact>
op
&dyn Op
inputs
Vec<&InferenceFact>