MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / infer_impl

Method infer_impl

tools/Polygraphy/polygraphy/backend/tf/runner.py:73–98  ·  view source on GitHub ↗
(self, feed_dict)

Source from the content-addressed store, hash-verified

71
72 @util.check_called_by("infer")
73 def infer_impl(self, feed_dict):
74 G_LOGGER.extra_verbose(f"Received feed_dict: {feed_dict}")
75 start = time.time()
76 inference_outputs = self.sess.run(
77 self.output_names, feed_dict=feed_dict, options=self.run_options, run_metadata=self.run_metadata
78 )
79 end = time.time()
80
81 out_dict = OrderedDict()
82 for name, out in zip(self.output_names, inference_outputs):
83 out_dict[name] = out
84 self.inference_time = end - start
85
86 if self.timeline_dir is not None:
87 from tensorflow.python.client import timeline
88
89 t1 = timeline.Timeline(self.run_metadata.step_stats)
90
91 util.save_file(
92 contents=t1.generate_chrome_trace_format(),
93 dest=os.path.join(self.timeline_dir, f"run-{self.num_inferences}"),
94 mode="w",
95 )
96 self.num_inferences += 1
97
98 return out_dict
99
100 @util.check_called_by("deactivate")
101 def deactivate_impl(self):

Callers 1

checkFunction · 0.45

Calls 2

extra_verboseMethod · 0.80
runMethod · 0.45

Tested by 1

checkFunction · 0.36