94472724eedd3382396d435fe2810422f472967e,tests/squeezenet.py,,,#,11

Before Change


import torch.nn as nn
from torch.autograd import Variable

sys.path.append("../pytorch2keras")
from converter import pytorch_to_keras

// The code from torchvision
import math

After Change


        return x.view(x.size(0), self.num_classes)


if __name__ == "__main__":
    max_error = 0
    for i in range(10):
        model = SqueezeNet(version=1.1)
        for m in model.modules():
            m.training = False

        input_np = np.random.uniform(0, 1, (1, 3, 224, 224))
        input_var = Variable(torch.FloatTensor(input_np))
        output = model(input_var)

        k_model = pytorch_to_keras(model, input_var, (3, 224, 224,), verbose=True)

        pytorch_output = output.data.numpy()
        keras_output = k_model.predict(input_np)

        error = np.max(pytorch_output - keras_output)
        print(error)
        if max_error < error:
            max_error = error

    print("Max error: {0}".format(max_error))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: nerox8664/pytorch2keras
Commit Name: 94472724eedd3382396d435fe2810422f472967e
Time: 2018-05-30
Author: nerox8664@gmail.com
File Name: tests/squeezenet.py
Class Name:
Method Name:


Project Name: jazzband/django-debug-toolbar
Commit Name: a8413f6f4129b53d8cf60d55468ac4b2545ed46d
Time: 2018-11-26
Author: thomas@deepomatic.com
File Name: debug_toolbar/panels/sql/utils.py
Class Name:
Method Name: reformat_sql


Project Name: nerox8664/pytorch2keras
Commit Name: 94472724eedd3382396d435fe2810422f472967e
Time: 2018-05-30
Author: nerox8664@gmail.com
File Name: tests/embedding.py
Class Name:
Method Name: