Skip to content
Snippets Groups Projects
Commit 4505a695 authored by Raul Marichal's avatar Raul Marichal
Browse files

Upload New File

parent e53097b5
No related branches found
No related tags found
No related merge requests found
import torch
from pytorch2keras.converter import pytorch_to_keras
from torch.autograd import Variable
input_tensor = torch.randn(1,3,224,224)
input_var = Variable(torch.FloatTensor(input_tensor))
filename = 'models/alexnet/alexnet-cifar10-edgetpu.pth.tar'
torch_model = torch.load(filename,map_location='cpu')
torch_model.eval()
print(torch_model)
keras_model = pytorch_to_keras(
torch_model,
input_var,
[input_var.shape[-3:]],
change_ordering=True,
name_policy="renumerate",
verbose=True
)
keras_model.summary()
keras_model.save('modelo_prueba')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment