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



        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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

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: kevinzakka/recurrent-visual-attention
Commit Name: f466871be6ee80533c997cf6c958aa41a697936f
Time: 2018-01-22
Author: kevinarmandzakka@gmail.com
File Name: trainer.py
Class Name: Trainer
Method Name: train_one_epoch


Project Name: chainer/chainerrl
Commit Name: a4f6690b9c4290a7f47761100523ff2ef5335964
Time: 2019-04-28
Author: muupan@gmail.com
File Name: chainerrl/agents/trpo.py
Class Name: TRPO
Method Name: act_and_train