@@ -0,0 +1,1309 @@
+from __future__ import division%0Afrom __future__ import unicode_literals%0Afrom __future__ import print_function%0Afrom __future__ import absolute_import%0Afrom builtins import super%0Afrom builtins import range%0Afrom future import standard_library%0Astandard_library.install_aliases()%0Aimport random%0A%0Aimport numpy as np%0Aimport chainer%0Afrom chainer import functions as F%0Afrom chainer import links as L%0Afrom chainer import cuda%0A%0A%0Aclass MLP(chainer.Chain):%0A    %22%22%22Multi-Layer Perceptron%22%22%22%0A%0A    def __init__(self, in_size, out_size, hidden_sizes):%0A        self.in_size = in_size%0A        self.out_size = out_size%0A        self.hidden_sizes = hidden_sizes%0A%0A        layers = %7B%7D%0A%0A        if hidden_sizes:%0A            hidden_layers = %5B%5D%0A            hidden_layers.append(L.Linear(in_size, hidden_sizes%5B0%5D))%0A            for hin, hout in zip(hidden_sizes, hidden_sizes%5B1:%5D):%0A                hidden_layers.append(L.Linear(hin, hout))%0A            layers%5B'hidden_layers'%5D = chainer.ChainList(*hidden_layers)%0A            layers%5B'output'%5D = L.Linear(hidden_sizes%5B-1%5D, out_size)%0A        else:%0A            layers%5B'output'%5D = L.Linear(in_size, out_size)%0A%0A        super().__init__(**layers)%0A%0A    def __call__(self, x, test=False):%0A        h = x%0A        for l in self.hidden_layers:%0A            h = F.relu(l(h))%0A        return self.output(h)%0A%0A

Add MLP