INNER CODE UNIT · Python
prepare
onnx/onnx-tensorrt · onnx_tensorrt/backend.py:227
def prepare(cls, model, device='CUDA:0', **kwargs):
"""Build an engine from the given model.
model -- An ONNX model as a deserialized protobuf, or a string or file-
object containing a serialized protobuf.
"""
super(TensorRTBackend, cls).prepare(model, device, **kwargs)
return TensorRTBackendRep(model, device, **kwargs)
@classmethod
def run_model(cls, model, inputs, device='CUDA:0', **kwargs):
"""Build and run an engine from the given model.
model -- An ONNX model as a deserialized protobuf, or a string or file-
object containing a serialized protobuf.
inputs -- Input tensor(s) as a Numpy array or list of Numpy arrays.
"""
return cls.prepare(model, device, **kwargs).run(inputs)
@classmethod
def run_node(cls, node, inputs, device='CUDA:0'):
"""Build and run an engine from the given node.