A Layers object is a pseudo-module which generates functions that specify layers; e.g., Layers().Convolution(bottom, kernel_size=3) will produce a Top specifying a 3x3 convolution applied to bottom.
| 197 | |
| 198 | |
| 199 | class Layers(object): |
| 200 | """A Layers object is a pseudo-module which generates functions that specify |
| 201 | layers; e.g., Layers().Convolution(bottom, kernel_size=3) will produce a Top |
| 202 | specifying a 3x3 convolution applied to bottom.""" |
| 203 | |
| 204 | def __getattr__(self, name): |
| 205 | def layer_fn(*args, **kwargs): |
| 206 | fn = Function(name, args, kwargs) |
| 207 | if fn.ntop == 0: |
| 208 | return fn |
| 209 | elif fn.ntop == 1: |
| 210 | return fn.tops[0] |
| 211 | else: |
| 212 | return fn.tops |
| 213 | return layer_fn |
| 214 | |
| 215 | |
| 216 | class Parameters(object): |