@@ -0,0 +1,2275 @@
+from __future__ import unicode_literals%0Afrom __future__ import print_function%0Afrom __future__ import division%0Afrom __future__ import absolute_import%0Afrom future import standard_library%0Afrom builtins import *  # NOQA%0Astandard_library.install_aliases()%0A%0Aimport chainer.links as L%0Aimport numpy as np%0A%0Aimport basetest_dqn_like as base%0Aimport chainerrl%0Afrom chainerrl.agents import C51%0A%0A%0Adef make_distrib_ff_q_func(env):%0A    n_atoms = 51%0A    v_max = 10%0A    v_min = -10%0A    delta_z = (v_max - v_min) / float(n_atoms - 1)%0A    z_values = np.array(%0A        %5Bv_min + i * delta_z for i in range(n_atoms)%5D, dtype=np.float32)%0A    return chainerrl.q_functions.DistributionalFCStateQFunctionWithDiscreteAction(  # NOQA%0A        env.observation_space.low.size, env.action_space.n,%0A        n_atoms=n_atoms,%0A        z_values=z_values,%0A        n_hidden_channels=20,%0A        n_hidden_layers=1,%0A    )%0A%0A%0Adef make_distrib_recurrent_q_func(env):%0A    n_atoms = 51%0A    v_max = 10%0A    v_min = -10%0A    delta_z = (v_max - v_min) / float(n_atoms - 1)%0A    z_values = np.array(%0A        %5Bv_min + i * delta_z for i in range(n_atoms)%5D, dtype=np.float32)%0A    return chainerrl.links.Sequence(%0A        L.LSTM(env.observation_space.low.size, 20),%0A        chainerrl.q_functions.DistributionalFCStateQFunctionWithDiscreteAction(  # NOQA%0A            20, env.action_space.n,%0A            n_atoms=n_atoms,%0A            z_values=z_values,%0A            n_hidden_channels=None,%0A            n_hidden_layers=0,%0A        ),%0A    )%0A%0A%0Aclass TestC51OnDiscreteABC(base._TestDQNOnDiscreteABC):%0A%0A    def make_q_func(self, env):%0A        return make_distrib_ff_q_func(env)%0A%0A    def make_dqn_agent(self, env, q_func, opt, explorer, rbuf, gpu):%0A        return C51(q_func, opt, rbuf, gpu=gpu, gamma=0.9, explorer=explorer,%0A                   replay_start_size=100, target_update_interval=100)%0A%0A%0A# Continuous action spaces are not supported%0A%0Aclass TestC51OnDiscretePOABC(base._TestDQNOnDiscretePOABC):%0A%0A    def make_q_func(self, env):%0A        return make_distrib_recurrent_q_func(env)%0A%0A    def make_dqn_agent(self, env, q_func, opt, explorer, rbuf, gpu):%0A        return C51(q_func, opt, rbuf, gpu=gpu, gamma=0.9, explorer=explorer,%0A                   replay_start_size=100, target_update_interval=100,%0A                   episodic_update=True)%0A

Add C51 tests