Last active
May 17, 2019 00:31
-
-
Save dsuess/131c209daa707ea4d13f810385f3b049 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import torch | |
from torch import nn | |
import onnx_tensorrt.backend as backend | |
import onnx | |
class Model(nn.Module): | |
def forward(self, x): | |
y = (2 * x)[0:1] | |
return y | |
model = Model().eval() | |
dummy_input = torch.randn(4, 4, 4) | |
with torch.no_grad(): | |
torch.onnx.export(model, dummy_input, 'test.onnx', verbose=True) | |
model = onnx.load('test.onnx') | |
engine = backend.prepare(model, device='CUDA:0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment