<s> """<STR_LIT>""" <EOL> import os <EOL> import json <EOL> import logging <EOL> from . common import epsilon , floatx , set_epsilon , set_floatx <EOL> _deepx_dir = os . path . expanduser ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> if not os . path . exists ( _deepx_dir ) : <EOL> os . makedirs ( _deepx_dir ) <EOL> _BACKEND = '<STR_LIT>' <EOL> _config_path = os . path . expanduser ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> if os . path . exists ( _config_path ) : <EOL> _config = json . load ( open ( _config_path ) ) <EOL> _floatx = _config . get ( '<STR_LIT>' , floatx ( ) ) <EOL> assert _floatx in { '<STR_LIT>' , '<STR_LIT>' } <EOL> _epsilon = _config . get ( '<STR_LIT>' , epsilon ( ) ) <EOL> assert type ( _epsilon ) == float <EOL> _backend = _config . get ( '<STR_LIT>' , _BACKEND ) <EOL> assert _backend in { '<STR_LIT>' , '<STR_LIT>' } <EOL> set_floatx ( _floatx ) <EOL> set_epsilon ( _epsilon ) <EOL> _BACKEND = _backend <EOL> else : <EOL> _config = { '<STR_LIT>' : floatx ( ) , <EOL> '<STR_LIT>' : epsilon ( ) , <EOL> '<STR_LIT>' : _BACKEND } <EOL> with open ( _config_path , '<STR_LIT:w>' ) as f : <EOL> f . write ( json . dumps ( _config ) + '<STR_LIT:\n>' ) <EOL> if '<STR_LIT>' in os . environ : <EOL> _backend = os . environ [ '<STR_LIT>' ] <EOL> assert _backend in { '<STR_LIT>' , '<STR_LIT>' } <EOL> _BACKEND = _backend <EOL> if _BACKEND == '<STR_LIT>' : <EOL> from . theano_backend import * <EOL> elif _BACKEND == '<STR_LIT>' : <EOL> from . tensorflow_backend import * <EOL> else : <EOL> raise Exception ( '<STR_LIT>' + str ( _BACKEND ) ) <EOL> logging . info ( "<STR_LIT>" , _BACKEND ) </s>
