-
Notifications
You must be signed in to change notification settings - Fork 29
/
play.py
43 lines (26 loc) · 952 Bytes
/
play.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'''
## Test ##
# Test a trained D4PG network. This can be run alongside training by running 'run_every_new_ckpt.sh'.
@author: Mark Sinton ([email protected])
'''
import tensorflow as tf
import numpy as np
from params import play_params
from agent import Agent
def play():
# Set random seeds for reproducability
np.random.seed(play_params.RANDOM_SEED)
tf.set_random_seed(play_params.RANDOM_SEED)
# Create session
config = tf.ConfigProto(allow_soft_placement=True)
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
# Initialise agent
agent = Agent(sess, play_params.ENV, play_params.RANDOM_SEED)
# Build network
agent.build_network(training=False)
# Run network in environment
agent.play()
sess.close()
if __name__ == '__main__':
play()