@@ -299,7 +299,7 @@ def tensor_name_generator() -> str:
299299 proto = autocast .pyvalue_to_onnx_attribute (
300300 attrname , attrval , tensor_name_generator , attrtype
301301 )
302- return self . ir_builder . make_attr (proto )
302+ return ir . from_proto (proto )
303303
304304 def _to_onnx_attr_ref (
305305 self , val : values .AttrRef , info : Optional [sourceinfo .SourceInfo ]
@@ -318,7 +318,8 @@ def _to_onnx_attr_ref(
318318 else :
319319 msg = f"Unsupported attribute type { pytype !r} ."
320320 fail (info .msg (msg ) if info else msg )
321- return self .ir_builder .make_attr_ref (attrname , val .value , pytype )
321+ attr_type = ir .AttributeType (ta .pytype_to_attrtype (pytype ))
322+ return ir .Attr (attrname , attr_type , None , val .value )
322323
323324 def _to_onnx_var (
324325 self ,
@@ -492,7 +493,8 @@ def _translate_attr(
492493 if isinstance (expr , ast .Name ):
493494 val = self ._lookup (expr .id , self ._source_of (expr ))
494495 if isinstance (val , values .AttrRef ):
495- attr_ref = self .ir_builder .make_attr_ref (attr_name , val .value , val .typeinfo )
496+ attr_type = ir .AttributeType (ta .pytype_to_attrtype (val .typeinfo ))
497+ attr_ref = ir .Attr (attr_name , attr_type , None , val .value )
496498 if attr_meta is not None and (attr_ref .type != attr_meta .type ):
497499 self .fail (
498500 expr ,
0 commit comments