(self, layer)
| 115 | return self._consumers.get(tensor_name, []) |
| 116 | |
| 117 | def add_layer(self, layer): |
| 118 | op = CaffeOperator() |
| 119 | op.layer = layer |
| 120 | self._ops[layer.name] = op |
| 121 | |
| 122 | # change op output name if it is an in-place op |
| 123 | layer.bottom[:] = [self._alias_op_output_name.get(layer_input, |
| 124 | layer_input) for |
| 125 | layer_input in layer.bottom][:] |
| 126 | for i in six.moves.range(len(layer.top)): |
| 127 | old_name = layer.top[i] |
| 128 | if layer.type == 'Input': |
| 129 | new_name = old_name |
| 130 | else: |
| 131 | idx = 0 |
| 132 | new_name = old_name + '#' + str(idx) |
| 133 | while new_name in self._used_op_output_name: |
| 134 | idx += 1 |
| 135 | new_name = old_name + '#' + str(idx) |
| 136 | layer.top[i] = new_name |
| 137 | self._alias_op_output_name[old_name] = new_name |
| 138 | self._used_op_output_name.update([new_name]) |
| 139 | for input_tensor in layer.bottom: |
| 140 | if input_tensor not in self._consumers: |
| 141 | self._consumers[input_tensor] = [] |
| 142 | self._consumers[input_tensor].append(op) |
| 143 | |
| 144 | def add_blob(self, weight): |
| 145 | if weight.name in self._ops: |
no test coverage detected