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: nerox8664/pytorch2keras
Commit Name: 94472724eedd3382396d435fe2810422f472967e
Time: 2018-05-30
Author: nerox8664@gmail.com
File Name: tests/embedding.py
Class Name:
Method Name:


Project Name: MTG/freesound
Commit Name: b425d17022e8491f590cf5065bbb1b36822232cc
Time: 2020-11-27
Author: frederic.font@gmail.com
File Name: search/templatetags/search.py
Class Name:
Method Name: display_facet