| 102 | are Tops from other layers).""" |
| 103 | |
| 104 | def __init__(self, type_name, inputs, params): |
| 105 | self.type_name = type_name |
| 106 | for index, input in enumerate(inputs): |
| 107 | if not isinstance(input, Top): |
| 108 | raise TypeError('%s input %d is not a Top (type is %s)' % |
| 109 | (type_name, index, type(input))) |
| 110 | self.inputs = inputs |
| 111 | self.params = params |
| 112 | self.ntop = self.params.get('ntop', 1) |
| 113 | # use del to make sure kwargs are not double-processed as layer params |
| 114 | if 'ntop' in self.params: |
| 115 | del self.params['ntop'] |
| 116 | self.in_place = self.params.get('in_place', False) |
| 117 | if 'in_place' in self.params: |
| 118 | del self.params['in_place'] |
| 119 | self.tops = tuple(Top(self, n) for n in range(self.ntop)) |
| 120 | |
| 121 | def _get_name(self, names, autonames): |
| 122 | if self not in names and self.ntop > 0: |