#NEWLINE# def register( self , name , obj , * tags , **kwargs ) : #NEWLINE# #INDENT# '\n\n        Parameters\n        ----------\n        name : str\n            Name of the optimizer.\n        obj\n            The optimizer to register.\n        tags\n            Tag name that allow to select the optimizer.\n        kwargs\n            If non empty, should contain only use_db_name_as_tag=False.\n            By default, all optimizations registered in EquilibriumDB\n            are selected when the EquilibriumDB name is used as a\n            tag. We do not want this behavior for some optimizer like\n            local_remove_all_assert. use_db_name_as_tag=False remove\n            that behavior. This mean only the optimizer name and the\n            tags specified will enable that optimization.\n\n        ' #NEWLINE# if ( not isinstance ( obj , ( DB , opt . Optimizer , opt . LocalOptimizer ) ) ) : #NEWLINE# #INDENT# raise TypeError ( 'Object cannot be registered in OptDB' , obj ) #NEWLINE# #UNINDENT# if ( name in self . __db__ ) : #NEWLINE# #INDENT# raise ValueError ( 'The name of the object cannot be an existing tag or the name of another existing object.' , obj , name ) #NEWLINE# #UNINDENT# if kwargs : #NEWLINE# #INDENT# assert ( 'use_db_name_as_tag' in kwargs ) #NEWLINE# assert ( kwargs [ 'use_db_name_as_tag' ] is False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . name is not None ) : #NEWLINE# #INDENT# tags = ( tags + ( self . name , ) ) #NEWLINE# #UNINDENT# #UNINDENT# obj . name = name #NEWLINE# if ( obj . name in self . __db__ ) : #NEWLINE# #INDENT# raise ValueError ( ( 'You can\'t register the same optimization\nmultiple time in a DB. Tryed to register "%s" again under the new name "%s".\n Use theano.gof.ProxyDB to work around that' % ( obj . name , name ) ) ) #NEWLINE# #UNINDENT# self . __db__ [ name ] = OrderedSet ( [ obj ] ) #NEWLINE# self . _names . add ( name ) #NEWLINE# self . __db__ [ obj . __class__ . __name__ ] . add ( self ) #NEWLINE# self . add_tags ( name , * tags )