Forward pass. Args: x (tensor): input data (image) Returns: tensor: depth
(self, x)
| 71 | |
| 72 | |
| 73 | def forward(self, x): |
| 74 | """Forward pass. |
| 75 | |
| 76 | Args: |
| 77 | x (tensor): input data (image) |
| 78 | |
| 79 | Returns: |
| 80 | tensor: depth |
| 81 | """ |
| 82 | if self.channels_last==True: |
| 83 | print("self.channels_last = ", self.channels_last) |
| 84 | x.contiguous(memory_format=torch.channels_last) |
| 85 | |
| 86 | |
| 87 | layer_1 = self.pretrained.layer1(x) |
| 88 | layer_2 = self.pretrained.layer2(layer_1) |
| 89 | layer_3 = self.pretrained.layer3(layer_2) |
| 90 | layer_4 = self.pretrained.layer4(layer_3) |
| 91 | |
| 92 | layer_1_rn = self.scratch.layer1_rn(layer_1) |
| 93 | layer_2_rn = self.scratch.layer2_rn(layer_2) |
| 94 | layer_3_rn = self.scratch.layer3_rn(layer_3) |
| 95 | layer_4_rn = self.scratch.layer4_rn(layer_4) |
| 96 | |
| 97 | |
| 98 | path_4 = self.scratch.refinenet4(layer_4_rn) |
| 99 | path_3 = self.scratch.refinenet3(path_4, layer_3_rn) |
| 100 | path_2 = self.scratch.refinenet2(path_3, layer_2_rn) |
| 101 | path_1 = self.scratch.refinenet1(path_2, layer_1_rn) |
| 102 | |
| 103 | out = self.scratch.output_conv(path_1) |
| 104 | |
| 105 | return torch.squeeze(out, dim=1) |
| 106 | |
| 107 | |
| 108 |
nothing calls this directly
no outgoing calls
no test coverage detected