-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathtraining.py
43 lines (28 loc) · 991 Bytes
/
training.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
from collections import namedtuple, deque
from torch.autograd import Variable
import torch
import UsefulComputations
import ActionGenerator
State = namedtuple('State', ['image', 'mission', 'advice'])
Trans = namedtuple('Trans', ['state', 'action', 'nextState', 'reward'])
model=ActionGenerator.ActionGenerator()
def selectAction(obs):
"""
Select the next action to be performed in an episode
@state tuple containing (image, mission, advice)
"""
# TODO
print('selectAction: implement me!')
image = obs['image']
mission = obs['mission']
advice = obs['advice']
#print('image: %s' % str(image.shape))
#print('mission: %s' % mission)
print('advice: %s' % advice)
import random
return random.randint(0, 3)
import os
import sys
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
print(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))