I am trying to override the report_layer_time method in tensorrt.Profiler class in the Python API to report layers timing but it doesn’t work as intended.
According to the API documentation here all I have to do is override the method in the child class, so I tried the following:
class MyProfiler(trt.Profiler):
def __init__(self):
super().__init__()
def report_layer_time(self, layer_name: str, ms: float):
print('Layer {} took {} ms'.format(layer_name, ms))
profiler = MyProfiler()
and then:
with engine.create_execution_context() as context:
context.profiler = profiler
However, my print method doesn’t have any effect. The default per-layer timing info is still printed as if my method didn’t override the default one.