INNER CODE UNIT · Python

_build_engine

onnx/onnx-tensorrt · onnx_tensorrt/backend.py:102

    def _build_engine(self, inputs=None):
        """
        Builds TensorRT Engine, with BuilderConfig if needed
        :param inputs: inputs to the model; if not None, this means we are building the engine at run time,
                       because we need to register optimization profiles for some inputs
        :type inputs: List of np.ndarray
        """

        if inputs:
            opt_profile = self.builder.create_optimization_profile()

            # Set optimization profiles for the input bindings that need them
            for i in range(self.network.num_inputs):
                inp_tensor = self.network.get_input(i)
                name = inp_tensor.name
                # Set profiles for shape tensors
                if inp_tensor.is_shape_tensor:
                    if inputs[i].ndim > 0:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…