<s> from __future__ import ( absolute_import , unicode_literals , print_function ) <EOL> __author__ = '<STR_LIT>' <EOL> __version__ = '<STR_LIT>' <EOL> import os <EOL> import re <EOL> import sys <EOL> import logging <EOL> class TheanoConfigurator ( object ) : <EOL> def __init__ ( self ) : <EOL> self . configured = False <EOL> self . log = logging . getLogger ( '<STR_LIT>' ) <EOL> def configure ( self , flags ) : <EOL> if self . configured is True : <EOL> return <EOL> self . configured = True <EOL> if '<STR_LIT>' in sys . modules : <EOL> self . log . warning ( '<STR_LIT>' ) <EOL> return <EOL> os . environ . setdefault ( '<STR_LIT>' , flags + '<STR_LIT>' ) <EOL> cuda = logging . getLogger ( '<STR_LIT>' ) <EOL> cuda . setLevel ( logging . CRITICAL ) <EOL> import theano <EOL> cuda . setLevel ( logging . WARNING ) <EOL> try : <EOL> import theano . sandbox . cuda as cd <EOL> self . log . info ( '<STR_LIT>' , cd . active_device_number ( ) , cd . active_device_name ( ) ) <EOL> except AttributeError : <EOL> self . log . info ( '<STR_LIT>' , theano . config . floatX ) <EOL> def __getattr__ ( self , name ) : <EOL> flags = '<STR_LIT>' <EOL> if name . endswith ( '<STR_LIT>' ) : <EOL> flags = '<STR_LIT>' <EOL> if name . endswith ( '<STR_LIT>' ) : <EOL> flags = '<STR_LIT>' <EOL> if name . startswith ( '<STR_LIT>' ) : <EOL> return self . configure ( '<STR_LIT>' + flags ) <EOL> if name . startswith ( '<STR_LIT>' ) : <EOL> return self . configure ( '<STR_LIT>' + flags ) <EOL> if name . startswith ( '<STR_LIT>' ) : <EOL> try : <EOL> count = int ( re . sub ( '<STR_LIT>' , '<STR_LIT>' , name ) ) <EOL> except ValueError : <EOL> import multiprocessing <EOL> count = multiprocessing . cpu_count ( ) <EOL> os . environ . setdefault ( '<STR_LIT>' , '<STR_LIT:U+002C>' . join ( [ '<STR_LIT>' , os . environ . get ( '<STR_LIT>' , '<STR_LIT>' ) ] ) ) <EOL> os . environ . setdefault ( '<STR_LIT>' , str ( count ) ) <EOL> return <EOL> return getattr ( sys . modules [ '<STR_LIT>' ] , name ) <EOL> sys . modules [ '<STR_LIT>' ] = TheanoConfigurator ( ) <EOL> try : <EOL> import colorama ; colorama . init ( ) ; del colorama <EOL> except ImportError : <EOL> pass </s>
