| 20 | return e_x / e_x.sum(axis=1, keepdims=True) |
| 21 | |
| 22 | class Maxout(object): |
| 23 | |
| 24 | def __init__(self, n_pool=2): |
| 25 | self.n_pool = n_pool |
| 26 | |
| 27 | def __call__(self, x): |
| 28 | if x.ndim == 2: |
| 29 | x = T.max([x[:, n::self.n_pool] for n in range(self.n_pool)], axis=0) |
| 30 | elif x.ndim == 4: |
| 31 | x = T.max([x[:, n::self.n_pool, :, :] for n in range(self.n_pool)], axis=0) |
| 32 | else: |
| 33 | raise NotImplementedError |
| 34 | return x |
| 35 | |
| 36 | class Rectify(object): |
| 37 |
nothing calls this directly
no outgoing calls
no test coverage detected