def METHOD_NAME(self, x: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
    confidences = []
    locations = []
    start_layer_index = 0
    header_index = 0
    for end_layer_index in self.source_layer_indexes:
        if isinstance(end_layer_index, GraphPath):
            path = end_layer_index
            end_layer_index = end_layer_index.s0
            added_layer = None
        elif isinstance(end_layer_index, tuple):
            added_layer = end_layer_index[1]
            end_layer_index = end_layer_index[0]
            path = None
        else:
            added_layer = None
            path = None
        for layer in self.base_net[start_layer_index: end_layer_index]:
            x = layer(x)
        if added_layer:
            y = added_layer(x)
        else:
            y = x
        if path:
            sub = getattr(self.base_net[end_layer_index], path.name)
            for layer in sub[:path.s1]:
                x = layer(x)
            y = x
            for layer in sub[path.s1:]:
                x = layer(x)
            end_layer_index += 1
        start_layer_index = end_layer_index
        confidence, location = self.compute_header(header_index, y)
        header_index += 1
        confidences.append(confidence)
        locations.append(location)
    for layer in self.base_net[end_layer_index:]:
        x = layer(x)
    for layer in self.extras:
        x = layer(x)
        confidence, location = self.compute_header(header_index, x)
        header_index += 1
        confidences.append(confidence)
        locations.append(location)
    confidences = torch.cat(confidences, 1)
    # (Todo zhiyuan) Convert to float due to Float16 += BFloat16 not supported
    # by TensorIterator yet, while Float32 += Half is OK
    locations = torch.cat(locations, 1).to(torch.float)
    if self.is_test:
        confidences = F.softmax(confidences, dim=2)
        boxes = torch.xpu.locations_to_boxes(locations, self.priors, self.config.center_variance, self.config.size_variance);
        return confidences, boxes
    else:
        return confidences, locations