Skip to content

Commit

Permalink
PropConst with OpaqueFact
Browse files Browse the repository at this point in the history
  • Loading branch information
hubertdelajonquieresonos authored and kali committed Dec 9, 2024
1 parent a185460 commit 47076fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/optim/prop_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,18 @@ impl super::TypedPass for PropConst {
}
let mut patch = TypedModelPatch::default();
for (ix, output) in res.into_iter().enumerate() {
let opaque_fact = model.outlet_fact(OutletId::new(node.id, ix))?.opaque_fact.clone();

let name = if ix > 0 {
format!("{}.{ix}", node.name)
} else {
node.name.clone()
};
let wire = patch.add_const(name, output.into_arc_tensor())?;
let wire = patch.wire_node(
name,
Const(output.into_arc_tensor(), opaque_fact),
&[],
)?[0];
patch.shunt_outside(model, (node.id, ix).into(), wire)?;
}
self.0 = node.id;
Expand Down

0 comments on commit 47076fe

Please sign in to comment.