Skip to content

Commit

Permalink
Migrating optimizer to new IR (part 1) (#1725)
Browse files Browse the repository at this point in the history
Migrated the core logic. 

TO DO: decide how to handle functions. Optimizer currently incorporates
function-specialization. Need to choose between function-specialization
and function-inlining.
  • Loading branch information
gramalingam authored Jul 17, 2024
1 parent f8ee736 commit d27aede
Show file tree
Hide file tree
Showing 4 changed files with 843 additions and 84 deletions.
7 changes: 7 additions & 0 deletions onnxscript/ir/serde.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"serialize_tensor_into",
"serialize_tensor",
"serialize_type_into",
"serialize_type",
"serialize_value_into",
"serialize_value",
"SerdeError",
Expand Down Expand Up @@ -1511,6 +1512,12 @@ def serialize_type_into(type_proto: onnx.TypeProto, from_: _protocols.TypeProtoc
raise TypeError(f"Unsupported type: {from_}")


def serialize_type(type_protocol: _protocols.TypeProtocol) -> onnx.TypeProto:
type_proto = onnx.TypeProto()
serialize_type_into(type_proto, from_=type_protocol)
return type_proto


@_capture_errors(lambda type_proto, from_: repr(from_))
def serialize_shape_into(type_proto: onnx.TypeProto, from_: _protocols.ShapeProtocol) -> None:
value_field = type_proto.WhichOneof("value")
Expand Down
Loading

0 comments on commit d27aede

Please sign in to comment.