import tensorrt as trt
import json

runtime = trt.Runtime(trt.Logger(trt.Logger.WARNING))
with open('/workspace/srvgg_x4.engine', 'rb') as f:
    engine = runtime.deserialize_cuda_engine(f.read())

inspector = engine.create_engine_inspector()
info = inspector.get_engine_information(trt.LayerInformationFormat.JSON)
data = json.loads(info)
layers = data.get('Layers', [])
print('Total layers:', len(layers))
print('Layers type:', type(layers[0]))
print('Sample layer:', repr(layers[0])[:200])

