TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
example Namespace Reference

Functions

def load_network (builder, network, parser)
 
def load_config (config)
 
def calib_data ()
 
def create_network (builder, network)
 

Variables

 X = gs.Variable(name="X", dtype=np.float32, shape=(1, 3, 5, 5))
 
 Y = gs.Variable(name="Y", dtype=np.float32, shape=(1, 3, 1, 1))
 
 node = gs.Node(op="GlobalLpPool", attrs={"p": 2}, inputs=[X], outputs=[Y])
 
 graph = gs.Graph(nodes=[node], inputs=[X], outputs=[Y])
 
 W = gs.Constant(name="W", values=np.ones(shape=(5, 3, 3, 3), dtype=np.float32))
 
 MODEL = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, "models", "identity.onnx")
 
 load_serialized_onnx = BytesFromPath(MODEL)
 
 build_onnxrt_session = SessionFromOnnxBytes(load_serialized_onnx)
 
 build_engine = EngineFromNetwork(NetworkFromOnnxBytes(load_serialized_onnx))
 
list runners
 
 run_results = Comparator.run(runners)
 
tuple INPUT_SHAPE = (1, 1, 2, 2)
 
list REAL_DATASET
 
list GOLDEN_VALUES = REAL_DATASET
 
 outputs = runner.infer(feed_dict={"x": data})
 
 calibrator = Calibrator(data_loader=calib_data(), cache="identity-calib.cache")
 
dictionary feed_dict = {"x": np.ones(shape=INPUT_SHAPE, dtype=np.float32)}
 
string INPUT_NAME = "input"
 
string OUTPUT_NAME = "output"
 

Function Documentation

◆ load_network()

def example.load_network (   builder,
  network,
  parser 
)

◆ load_config()

def example.load_config (   config)

◆ calib_data()

def example.calib_data ( )

◆ create_network()

def example.create_network (   builder,
  network 
)

Variable Documentation

◆ X

example.X = gs.Variable(name="X", dtype=np.float32, shape=(1, 3, 5, 5))

◆ Y

example.Y = gs.Variable(name="Y", dtype=np.float32, shape=(1, 3, 1, 1))

◆ node

example.node = gs.Node(op="GlobalLpPool", attrs={"p": 2}, inputs=[X], outputs=[Y])

◆ graph

example.graph = gs.Graph(nodes=[node], inputs=[X], outputs=[Y])

◆ W

example.W = gs.Constant(name="W", values=np.ones(shape=(5, 3, 3, 3), dtype=np.float32))

◆ MODEL

example.MODEL = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, "models", "identity.onnx")

◆ load_serialized_onnx

example.load_serialized_onnx = BytesFromPath(MODEL)

◆ build_onnxrt_session

example.build_onnxrt_session = SessionFromOnnxBytes(load_serialized_onnx)

◆ build_engine

example.build_engine = EngineFromNetwork(NetworkFromOnnxBytes(load_serialized_onnx))

◆ runners

list example.runners
Initial value:
1 = [
2  TrtRunner(build_engine),
3  OnnxrtRunner(build_onnxrt_session),
4 ]

◆ run_results

example.run_results = Comparator.run(runners)

◆ INPUT_SHAPE

tuple example.INPUT_SHAPE = (1, 1, 2, 2)

◆ REAL_DATASET

list example.REAL_DATASET
Initial value:
1 = [ # Definitely real data
2  np.ones(INPUT_SHAPE, dtype=np.float32),
3  np.zeros(INPUT_SHAPE, dtype=np.float32),
4  np.ones(INPUT_SHAPE, dtype=np.float32),
5  np.zeros(INPUT_SHAPE, dtype=np.float32),
6 ]

◆ GOLDEN_VALUES

list example.GOLDEN_VALUES = REAL_DATASET

◆ outputs

example.outputs = runner.infer(feed_dict={"x": data})

◆ calibrator

example.calibrator = Calibrator(data_loader=calib_data(), cache="identity-calib.cache")

◆ feed_dict

dictionary example.feed_dict = {"x": np.ones(shape=INPUT_SHAPE, dtype=np.float32)}

◆ INPUT_NAME

string example.INPUT_NAME = "input"

◆ OUTPUT_NAME

string example.OUTPUT_NAME = "output"