def exit_tf(sess=None):
 text = '[tl] Close tensorboard and nvidia-process if available'
 sess.close()
 if ((_platform == 'linux') or (_platform == 'linux2')):
  print ('linux: %s' % text)
  os.system('nvidia-smi')
  os.system('fuser 6006/tcp -k')
  os.system("nvidia-smi | grep python |awk '{print $3}'|xargs kill")
 elif (_platform == 'darwin'):
  print ('OS X: %s' % text)
  os.system("lsof -i tcp:6006 | grep -v PID | awk '{print $2}' | xargs kill")
 elif (_platform == 'win32'):
  print ('Windows: %s' % text)
 else:
  print _platform
 exit()

def exit_tf ( sess = None ) : text = '[tl] Close tensorboard and nvidia-process if available' sess . close ( ) if ( ( _platform == 'linux' ) or ( _platform == 'linux2' ) ) : print ( 'linux: %s' % text ) os . system ( 'nvidia-smi' ) os . system ( 'fuser 6006/tcp -k' ) os . system ( "nvidia-smi | grep python |awk '{print $3}'|xargs kill" ) elif ( _platform == 'darwin' ) : print ( 'OS X: %s' % text ) os . system ( "lsof -i tcp:6006 | grep -v PID | awk '{print $2}' | xargs kill" ) elif ( _platform == 'win32' ) : print ( 'Windows: %s' % text ) else : print _platform exit ( )
close tensorboard and nvidia-process if available parameters sess : a session instance of tensorflow tensorflow session .