9b0a0dd6fe7b4ac021d91acc6b4f96b403dd6b67,models.py,Darknet,forward,#Darknet#,250

Before Change


        is_training = targets is not None
        for yolo_layer in self.yolo_layers:
            yolo_layer.img_dim = x.shape[2]
        output = []
        loss = 0
        layer_outputs = []
        for i, (module_def, module) in enumerate(zip(self.module_defs, self.module_list)):
            if module_def["type"] in ["convolutional", "upsample", "maxpool"]:
                x = module(x)
            elif module_def["type"] == "route":
                layer_i = [int(x) for x in module_def["layers"].split(",")]
                x = torch.cat([layer_outputs[i] for i in layer_i], 1)
            elif module_def["type"] == "shortcut":
                layer_i = int(module_def["from"])
                x = layer_outputs[-1] + layer_outputs[layer_i]
            elif module_def["type"] == "yolo":
                if is_training:
                    x, layer_loss = module[0](x, targets)
                    loss += layer_loss
                else:
                    x = module(x)
                output.append(x)
            layer_outputs.append(x)

        if is_training:
            return loss, to_cpu(torch.cat(output, 1))
        else:
            return to_cpu(torch.cat(output, 1))

    def load_darknet_weights(self, weights_path):
        Parses and loads the weights stored in "weights_path"

After Change


                loss += layer_loss
                yolo_outputs.append(x)
            layer_outputs.append(x)
        yolo_outputs = to_cpu(torch.cat(yolo_outputs, 1))
        return yolo_outputs if targets is None else (loss, yolo_outputs)

    def load_darknet_weights(self, weights_path):
        Parses and loads the weights stored in "weights_path"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: eriklindernoren/PyTorch-YOLOv3
Commit Name: 9b0a0dd6fe7b4ac021d91acc6b4f96b403dd6b67
Time: 2019-04-26
Author: eriklindernoren@live.se
File Name: models.py
Class Name: Darknet
Method Name: forward


Project Name: gpleiss/efficient_densenet_pytorch
Commit Name: 9eb1ae1a59c9c0b1611551937d8fd3406c1553ba
Time: 2017-05-31
Author: gpleiss@gmail.com
File Name: models/densenet_efficient.py
Class Name: _DenseLayer
Method Name: forward


Project Name: gpleiss/efficient_densenet_pytorch
Commit Name: 445b161071b06cc493c6418892219d64ae3b84f0
Time: 2018-04-26
Author: gpleiss@gmail.com
File Name: models/densenet.py
Class Name: _DenseLayer
Method Name: forward