Collect the bottoms to walk for the coordinate mapping. The general rule is that all the bottoms of a layer can be mapped, as most layers have the same coordinate mapping for each bottom. Crop layer is a notable exception. Only the first/cropped bottom is map
(top)
| 124 | # For now use a brute-force algorithm. |
| 125 | |
| 126 | def collect_bottoms(top): |
| 127 | """ |
| 128 | Collect the bottoms to walk for the coordinate mapping. |
| 129 | The general rule is that all the bottoms of a layer can be mapped, as |
| 130 | most layers have the same coordinate mapping for each bottom. |
| 131 | Crop layer is a notable exception. Only the first/cropped bottom is |
| 132 | mappable; the second/dimensions bottom is excluded from the walk. |
| 133 | """ |
| 134 | bottoms = top.fn.inputs |
| 135 | if top.fn.type_name == 'Crop': |
| 136 | bottoms = bottoms[:1] |
| 137 | return bottoms |
| 138 | |
| 139 | # walk back from top_from, keeping the coord map as we go |
| 140 | from_maps = {top_from: (None, 1, 0)} |