Преглед на файлове

modify npu models infer bug (#2474)

a31413510 преди 1 година
родител
ревизия
e4e9a12535
променени са 1 файла, в които са добавени 8 реда и са изтрити 6 реда
  1. 8 6
      paddlex/inference/components/paddle_predictor/predictor.py

+ 8 - 6
paddlex/inference/components/paddle_predictor/predictor.py

@@ -176,12 +176,14 @@ class BasePaddlePredictor(BaseComponent):
 
         config.set_cpu_math_library_num_threads(self.option.cpu_threads)
 
-        if not (self.option.device == "gpu" and self.option.run_mode.startswith("trt")):
-            if hasattr(config, "enable_new_ir"):
-                config.enable_new_ir(self.option.enable_new_ir)
-            if hasattr(config, "enable_new_executor"):
-                config.enable_new_executor()
-            if self.option.device in ("cpu", "gpu"):
+        if self.option.device in ("cpu", "gpu"):
+            if not (
+                self.option.device == "gpu" and self.option.run_mode.startswith("trt")
+            ):
+                if hasattr(config, "enable_new_ir"):
+                    config.enable_new_ir(self.option.enable_new_ir)
+                if hasattr(config, "enable_new_executor"):
+                    config.enable_new_executor()
                 config.set_optimization_level(3)
 
         for del_p in self.option.delete_pass: