def test_rforward_finite_differences_multilayer(self): check_errors = [] for l, a in itertools.product(self.layer_types, self.activation_functions): net = self.build_network(l, a, layers=2) e, allerrors = check_rpass(net, n_batches=5, n_timesteps=7, rnd=rnd) check_errors.append(e) if e > 1e-4: # construct a weight view and break down the differences layer = net.layers.values()[1] # the only layer b = Matrix(allerrors.copy()) diff = layer.create_param_view(b) for n, q in diff.items(): print("====== %s ======" % n) print(q) print("Checking RForward pass of %s with %s = %0.4g" % (l(3), a, e)) self.assertTrue(np.all(np.array(check_errors) < 1e-4))
def test_rforward_finite_differences(self): check_errors = [] for cfg in self.lstm_configs: net = self.build_network(cfg) e, allerrors = check_rpass(net, n_batches=5, n_timesteps=2, rnd=rnd) check_errors.append(e) if e > 1e-4: # construct a weight view and break down the differences layer = net.layers.values()[1] # the only layer b = Matrix(allerrors.copy()) diff = layer.create_param_view(b) for n, q in diff.items(): print("====== %s ======" % n) print(q) print("Checking RForward pass of Lstm97 with %s = %0.4g" % (cfg, e)) self.assertTrue(np.all(np.array(check_errors) < 1e-4))