|
1 | | -__author__ = 'Michael Isik' |
2 | | - |
| 1 | +# -*- coding: utf-8 -*- |
3 | 2 |
|
4 | 3 | from pybrain.structure.networks.network import Network |
5 | 4 | from pybrain.structure.modules.lstm import LSTMLayer |
|
10 | 9 |
|
11 | 10 | from numpy import zeros, array, append |
12 | 11 |
|
| 12 | +__author__ = 'Michael Isik' |
| 13 | + |
13 | 14 |
|
14 | 15 | class EvolinoNetwork(Module): |
15 | 16 | def __init__(self, indim, outdim, hiddim=6): |
@@ -41,13 +42,19 @@ def __init__(self, indim, outdim, hiddim=6): |
41 | 42 | def reset(self): |
42 | 43 | self._network.reset() |
43 | 44 |
|
44 | | - |
45 | 45 | def _washout(self, input, target, first_idx=None, last_idx=None): |
46 | | - assert self.indim == len(input[0]) |
47 | | - assert self.outdim == len(target[0]) |
48 | | - assert len(input) == len(target) |
| 46 | + if self.indim != len(input[0]): |
| 47 | + raise Exception("{} must be equal to {}".format(str(self.indim), str(len(input[0])))) |
| 48 | + |
| 49 | + if self.outdim != len(target[0]): |
| 50 | + raise Exception("{} must be equal to {}".format(str(self.outdim), str(len(target[0])))) |
| 51 | + |
| 52 | + if len(input) != len(target): |
| 53 | + raise Exception("{} must be equal to {}".format(str(len(input)), str(len(target)))) |
| 54 | + |
| 55 | + if first_idx is None: |
| 56 | + first_idx = 0 |
49 | 57 |
|
50 | | - if first_idx is None: first_idx = 0 |
51 | 58 | if last_idx is None: last_idx = len(target) - 1 |
52 | 59 | raw_outputs = [] |
53 | 60 | for i in xrange(first_idx, last_idx + 1): |
|
0 commit comments