Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions deep_q_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import random
import numpy as np
from collections import deque

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
GAME = 'bird' # the name of the game being played for log files
ACTIONS = 2 # number of valid actions
GAMMA = 0.99 # decay rate of past observations
Expand All @@ -21,8 +22,10 @@
BATCH = 32 # size of minibatch
FRAME_PER_ACTION = 1


def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev = 0.01)
initial = tf.random.truncated_normal(shape, stddev = 0.01)

return tf.Variable(initial)

def bias_variable(shape):
Expand Down Expand Up @@ -204,7 +207,9 @@ def trainNetwork(s, readout, h_fc1, sess):
'''

def playGame():
sess = tf.InteractiveSession()
#sess = tf.InteractiveSession()
sess=tf.compat.v1.InteractiveSession()

s, readout, h_fc1 = createNetwork()
trainNetwork(s, readout, h_fc1, sess)

Expand Down