@@ -28,7 +28,7 @@ use crate::runtime::array::Array;
2828use crate :: runtime:: function:: Result ;
2929use crate :: runtime:: map:: Map ;
3030use crate :: runtime:: string:: String as TVMString ;
31- use crate :: runtime:: { external, IsObjectRef , Object } ;
31+ use crate :: runtime:: { external, IsObjectRef , Object , ObjectRef } ;
3232
3333use super :: expr:: GlobalVar ;
3434use super :: function:: BaseFunc ;
@@ -62,7 +62,7 @@ external! {
6262 #[ name( "relay.parser.ParseExpr" ) ]
6363 fn parse_expression( file_name: TVMString , source: TVMString ) -> IRModule ;
6464 #[ name( "ir.IRModule" ) ]
65- fn module_new( funcs: Map <GlobalVar , BaseFunc >, types: Map <GlobalTypeVar , TypeData >) -> IRModule ;
65+ fn module_new( funcs: Map <GlobalVar , BaseFunc >, types: Map <GlobalTypeVar , TypeData >, attrs : Map < TVMString , ObjectRef > ) -> IRModule ;
6666 // Module methods
6767 #[ name( "ir.Module_Add" ) ]
6868 fn module_add( module: IRModule , type_name: GlobalVar , expr: BaseFunc , update: bool ) -> IRModule ;
@@ -99,18 +99,24 @@ external! {
9999// Note: we don't expose update here as update is going to be removed.
100100
101101impl IRModule {
102- pub fn new < ' a , F , T > ( funcs : F , types : T ) -> Result < IRModule >
102+ pub fn new < ' a , F , T , A > ( funcs : F , types : T , attrs : A ) -> Result < IRModule >
103103 where
104104 F : IntoIterator < Item = ( & ' a GlobalVar , & ' a BaseFunc ) > ,
105105 T : IntoIterator < Item = ( & ' a GlobalTypeVar , & ' a TypeData ) > ,
106+ A : IntoIterator < Item = ( & ' a TVMString , & ' a ObjectRef ) > ,
106107 {
107- module_new ( Map :: from_iter ( funcs) , Map :: from_iter ( types) )
108+ module_new (
109+ Map :: from_iter ( funcs) ,
110+ Map :: from_iter ( types) ,
111+ Map :: from_iter ( attrs) ,
112+ )
108113 }
109114
110115 pub fn empty ( ) -> Result < IRModule > {
111116 let funcs = HashMap :: < GlobalVar , BaseFunc > :: new ( ) ;
112117 let types = HashMap :: < GlobalTypeVar , TypeData > :: new ( ) ;
113- IRModule :: new ( funcs. iter ( ) , types. iter ( ) )
118+ let attrs = HashMap :: < TVMString , ObjectRef > :: new ( ) ;
119+ IRModule :: new ( funcs. iter ( ) , types. iter ( ) , attrs. iter ( ) )
114120 }
115121
116122 pub fn parse < N , S > ( file_name : N , source : S ) -> Result < IRModule >
0 commit comments