Last active
March 28, 2019 23:55
-
-
Save dsuess/bd4f3385451241a48338c0e01f74d4fc to your computer and use it in GitHub Desktop.
Revisions
-
dsuess revised this gist
Mar 28, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ import torch from torch import nn import tensorrt as trt TRT_LOGGER = trt.Logger(trt.Logger.INFO) -
dsuess renamed this gist
Mar 28, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
dsuess created this gist
Mar 28, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ import torch from torch import nn import tensorrt as trt import click TRT_LOGGER = trt.Logger(trt.Logger.INFO) class Model(nn.Module): def forward(self, x): y = (2 * x)[0:1] return y print('TensorRT version:', trt.__version__) model = Model().eval() dummy_input = torch.randn(4, 4, 4) with torch.no_grad(): torch.onnx.export(model, dummy_input, 'test.onnx', verbose=True) with trt.Builder(TRT_LOGGER) as builder, \ builder.create_network() as network, \ trt.OnnxParser(network, TRT_LOGGER) as parser: with open('test.onnx', 'rb') as model: success = parser.parse(model.read()) assert success, f'{parser.num_errors} detected during parsing'