Q_train = deepQNetwork.DeepQNetwork(height, width, historyLength, n_actions, gamma, learningRate, SEED) with tf.variable_scope("target") as target_scope: Q_target = deepQNetwork.DeepQNetwork(height, width, historyLength, n_actions, gamma, learningRate, SEED) sess = tf.InteractiveSession() sess.run(tf.initialize_all_variables()) saver = tf.train.Saver(max_to_keep=None) if loadModel is True: saver.restore(sess, modelPath) log = myLog.Log(logPath, 'w+') print time.strftime(MYTIMEFORMAT, time.localtime()) print 'simulation start!' memory = Memory.Memory(path=dataPath, size=memorySize, historySize=historyLength, dims=[height, width], seed=SEED) State0 = np.zeros([batchSize, network_size]) State1 = np.zeros([batchSize, network_size]) Action0 = np.zeros([batchSize]) Reward0 = np.zeros([batchSize]) Terminal = np.zeros([batchSize])
config = tf.ConfigProto() config.gpu_options.allow_growth = True config.allow_soft_placement = True sess = tf.InteractiveSession(config=config) sess.run(tf.initialize_all_variables()) frameStart = 0 saver = tf.train.Saver(max_to_keep=None) if loadModel is True: print 'Loading model from %s ...' % pathModel, saver.restore(sess, pathModel) print 'Finished\n' # frameStart = freqTest log = myLog.Log(pathLog, 'w+') print time.strftime(MYTIMEFORMAT, time.localtime()), '\n' print open('Options.py').read() print 'SEED = %d\n' % SEED memory = Memory.Memory(opt) if loadData is True: print 'Loading data from %s ...' % pathData, memory.load(pathData) print 'Finished\n' trainStart = False cost_average = 0.0 Q_average = 0.0