Get Inception feature maps Parameters ---------- inp : torch.autograd.Variable Input tensor of shape Bx3xHxW. Values are expected to be in range (0, 1) Returns ------- List of torch.autograd.Variable, corresponding to the sele
(self, inp)
| 111 | param.requires_grad = requires_grad |
| 112 | |
| 113 | def forward(self, inp): |
| 114 | """Get Inception feature maps |
| 115 | |
| 116 | Parameters |
| 117 | ---------- |
| 118 | inp : torch.autograd.Variable |
| 119 | Input tensor of shape Bx3xHxW. Values are expected to be in |
| 120 | range (0, 1) |
| 121 | |
| 122 | Returns |
| 123 | ------- |
| 124 | List of torch.autograd.Variable, corresponding to the selected output |
| 125 | block, sorted ascending by index |
| 126 | """ |
| 127 | outp = [] |
| 128 | x = inp |
| 129 | |
| 130 | if self.resize_input: |
| 131 | x = F.upsample(x, |
| 132 | size=(299, 299), |
| 133 | mode='bilinear', |
| 134 | align_corners=False) |
| 135 | |
| 136 | if self.normalize_input: |
| 137 | x = 2 * x - 1 # Scale from range (0, 1) to range (-1, 1) |
| 138 | |
| 139 | for idx, block in enumerate(self.blocks): |
| 140 | x = block(x) |
| 141 | if idx in self.output_blocks: |
| 142 | outp.append(x) |
| 143 | |
| 144 | if idx == self.last_needed_block: |
| 145 | break |
| 146 | |
| 147 | return outp |
nothing calls this directly
no outgoing calls
no test coverage detected