You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/12/19 05:35:53 UTC

[incubator-mxnet] branch master updated: Fix example/reinforcement-learning/dqn (#9128)

This is an automated email from the ASF dual-hosted git repository.

jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new d1d3e97  Fix example/reinforcement-learning/dqn (#9128)
d1d3e97 is described below

commit d1d3e97c0c35dbbea325a36171c94b1005a8fbeb
Author: mbaijal <30...@users.noreply.github.com>
AuthorDate: Mon Dec 18 21:35:48 2017 -0800

    Fix example/reinforcement-learning/dqn (#9128)
    
    * Some changes to make dqn compatible with python 3
    
    * Update README
    
    * union of dict_items does not work in python2.7. Change to list
---
 example/reinforcement-learning/dqn/README.md     | Bin 1032 -> 1752 bytes
 example/reinforcement-learning/dqn/atari_game.py |  12 ++++++------
 example/reinforcement-learning/dqn/base.py       |   2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/example/reinforcement-learning/dqn/README.md b/example/reinforcement-learning/dqn/README.md
index 8a73e1d..58f7b56 100644
Binary files a/example/reinforcement-learning/dqn/README.md and b/example/reinforcement-learning/dqn/README.md differ
diff --git a/example/reinforcement-learning/dqn/atari_game.py b/example/reinforcement-learning/dqn/atari_game.py
index 5c1314f..43c298a 100644
--- a/example/reinforcement-learning/dqn/atari_game.py
+++ b/example/reinforcement-learning/dqn/atari_game.py
@@ -44,18 +44,18 @@ def ale_load_from_rom(rom_path, display_screen):
                            'installation guidance')
 
     ale = ALEInterface()
-    ale.setInt('random_seed', rng.randint(1000))
+    ale.setInt(b'random_seed', rng.randint(1000))
     if display_screen:
         import sys
         if sys.platform == 'darwin':
             import pygame
             pygame.init()
-            ale.setBool('sound', False) # Sound doesn't work on OSX
-        ale.setBool('display_screen', True)
+            ale.setBool(b'sound', False) # Sound doesn't work on OSX
+        ale.setBool(b'display_screen', True)
     else:
-        ale.setBool('display_screen', False)
-    ale.setFloat('repeat_action_probability', 0)
-    ale.loadROM(rom_path)
+        ale.setBool(b'display_screen', False)
+    ale.setFloat(b'repeat_action_probability', 0)
+    ale.loadROM(str.encode(rom_path))
     return ale
 
 
diff --git a/example/reinforcement-learning/dqn/base.py b/example/reinforcement-learning/dqn/base.py
index ce82f2b..982ae17 100644
--- a/example/reinforcement-learning/dqn/base.py
+++ b/example/reinforcement-learning/dqn/base.py
@@ -135,7 +135,7 @@ class Base(object):
                 self.initializer(k, v)
         else:
             assert set(arg_name_shape.items()) == \
-                   set(data_shapes.items() + [(k, v.shape) for k, v in self.params.items()])
+                   set(list(data_shapes.items()) + list([(k, v.shape) for k, v in self.params.items()]))
         if self.aux_states is None:
             self.aux_states = OrderedDict([(k, nd.empty(s, ctx=self.ctx))
                                            for k, s in zip(aux_names, aux_shapes)])

-- 
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].