Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
33353f33
Commit
33353f33
authored
Jun 04, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a default implementation for restart_episode
parent
dee9d398
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
tensorpack/RL/common.py
tensorpack/RL/common.py
+1
-1
tensorpack/RL/envbase.py
tensorpack/RL/envbase.py
+1
-1
tensorpack/utils/concurrency.py
tensorpack/utils/concurrency.py
+2
-2
No files found.
tensorpack/RL/common.py
View file @
33353f33
...
@@ -86,7 +86,7 @@ class LimitLengthPlayer(ProxyPlayer):
...
@@ -86,7 +86,7 @@ class LimitLengthPlayer(ProxyPlayer):
isOver
=
True
isOver
=
True
self
.
player
.
restart_episode
()
self
.
player
.
restart_episode
()
if
isOver
:
if
isOver
:
print
self
.
cnt
#print self.cnt, self.player.stats # to see what limit is appropriate
self
.
cnt
=
0
self
.
cnt
=
0
return
(
r
,
isOver
)
return
(
r
,
isOver
)
...
...
tensorpack/RL/envbase.py
View file @
33353f33
...
@@ -29,9 +29,9 @@ class RLEnvironment(object):
...
@@ -29,9 +29,9 @@ class RLEnvironment(object):
:returns: (reward, isOver)
:returns: (reward, isOver)
"""
"""
@
abstractmethod
def
restart_episode
(
self
):
def
restart_episode
(
self
):
""" Start a new episode, even if the current hasn't ended """
""" Start a new episode, even if the current hasn't ended """
raise
NotImplementedError
()
def
get_stat
(
self
):
def
get_stat
(
self
):
"""
"""
...
...
tensorpack/utils/concurrency.py
View file @
33353f33
...
@@ -44,7 +44,7 @@ class StoppableThread(threading.Thread):
...
@@ -44,7 +44,7 @@ class StoppableThread(threading.Thread):
try
:
try
:
q
.
put
(
obj
,
timeout
=
5
)
q
.
put
(
obj
,
timeout
=
5
)
break
break
except
queue
.
Queue
.
Full
:
except
queue
.
Full
:
pass
pass
def
queue_get_stoppable
(
self
,
q
):
def
queue_get_stoppable
(
self
,
q
):
...
@@ -52,7 +52,7 @@ class StoppableThread(threading.Thread):
...
@@ -52,7 +52,7 @@ class StoppableThread(threading.Thread):
while
not
self
.
stopped
():
while
not
self
.
stopped
():
try
:
try
:
return
q
.
get
(
timeout
=
5
)
return
q
.
get
(
timeout
=
5
)
except
queue
.
Queue
.
Full
:
except
queue
.
Empty
:
pass
pass
class
LoopThread
(
threading
.
Thread
):
class
LoopThread
(
threading
.
Thread
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment