94472724eedd3382396d435fe2810422f472967e,tests/embedding.py,,,#,9
Before Change
import torch.nn as nn
from torch.autograd import Variable
sys.path.append("../pytorch2keras")
from converter import pytorch_to_keras
class TestEmbedding(nn.Module):
After Change
return self.embedd(input)
if __name__ == "__main__":
max_error = 0
for i in range(100):
input_np = np.random.randint(0, 10, (1, 1, 4))
input = Variable(torch.LongTensor(input_np))
simple_net = TestEmbedding(1000)
output = simple_net(input)
k_model = pytorch_to_keras(simple_net, input, (1, 4), verbose=True)
pytorch_output = output.data.numpy()
keras_output = k_model.predict(input_np)
error = np.max(pytorch_output - keras_output[0])
print(error)
if max_error < error:
max_error = error
print("Max error: {0}".format(max_error))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances 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: nerox8664/pytorch2keras
Commit Name: 94472724eedd3382396d435fe2810422f472967e
Time: 2018-05-30
Author: nerox8664@gmail.com
File Name: tests/squeezenet.py
Class Name:
Method Name:
Project Name: biolab/orange3
Commit Name: 86c29b91c8581146079d9615982f588f197678e7
Time: 2016-03-18
Author: tankovesna@hotmail.com
File Name: Orange/widgets/classify/owclassificationtreegraph.py
Class Name: TreeNode
Method Name: rulew