#NEWLINE# @ typed_macro #NEWLINE# def size( xt , axis = None ) : #NEWLINE# #INDENT# if ( axis is None ) : #NEWLINE# #INDENT# axis = zero_i64 #NEWLINE# #UNINDENT# assert isinstance ( axis , Const ) , ( "Axis argument to 'size' must be a constant, given %s" % axis ) #NEWLINE# assert ( axis . value == 0 ) , ( "Calling 'size' along axes other than 0 not yet supported, given %s" % axis ) #NEWLINE# if isinstance ( xt . type , ArrayT ) : #NEWLINE# #INDENT# return Attribute ( axis , 'size' , type = Int64 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( xt . type , TupleT ) : #NEWLINE# #INDENT# return const_int ( len ( xt . type . elt_types ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return const_int ( 1 )