#NEWLINE# def get_config( self ) : #NEWLINE# #INDENT# 'Returns the model configuration\n        as a Python dictionary.\n        ' #NEWLINE# config = [ ] #NEWLINE# if ( self . layers [ 0 ] . __class__ . __name__ == 'Merge' ) : #NEWLINE# #INDENT# assert hasattr ( self . layers [ 0 ] , 'layers' ) #NEWLINE# layers = [ ] #NEWLINE# for layer in self . layers [ 0 ] . layers : #NEWLINE# #INDENT# layer_config = { #NEWLINE# #INDENT# 'class_name' : layer . __class__ . __name__ , #NEWLINE# 'config' : layer . get_config ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# layers . append ( layer_config ) #NEWLINE# #UNINDENT# merge_config = self . layers [ 0 ] . get_config ( ) #NEWLINE# merge_config [ 'layers' ] = layers #NEWLINE# config . append ( { #NEWLINE# #INDENT# 'class_name' : 'Merge' , #NEWLINE# 'config' : merge_config , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# config . append ( { #NEWLINE# #INDENT# 'class_name' : self . layers [ 0 ] . __class__ . __name__ , #NEWLINE# 'config' : self . layers [ 0 ] . get_config ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# for layer in self . layers [ 1 : ] : #NEWLINE# #INDENT# config . append ( { #NEWLINE# #INDENT# 'class_name' : layer . __class__ . __name__ , #NEWLINE# 'config' : layer . get_config ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return copy . deepcopy ( config )