Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions tket/src/serialize/pytket/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,19 +885,21 @@ impl<H: HugrView> PytketEncoderContext<H> {
}
}
OpType::LoadConstant(constant) => {
// If we are loading a supported type, emit a transparent node
// by reassigning the input values to the new outputs.
//
// Otherwise, if we're loading an unsupported type, this node
// should be part of an unsupported subgraph.
let cst = circ
.hugr()
.single_linked_output(node, constant.constant_port())
.expect("LoadConstant must have a linked Const");
// Check if the Const was successfully encoded
if self
.config()
.type_to_pytket(constant.constant_type())
.values
.peek_wire_values(Wire::new(cst.0, cst.1))
.is_some()
{
self.emit_transparent_node(node, circ, |ps| ps.input_params.to_owned())?;
return Ok(EncodeStatus::Success);
}
// Otherwise (inc. if we're loading an unsupported type), this node
// should be part of an unsupported subgraph.
}
OpType::Const(op) => {
let config = Arc::clone(&self.config);
Expand Down
Loading