1
2
3
[TensorRT] ERROR: Network must hav at least one output

AttributeError: 'NoneType' object has no attribute 'serialize'

解决方案

给代码中的create_network()传入如下参数

1
2
explicit_batch = 1 << (int)(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)
builder.create_network(explicit_batch)