From 419c2d1458c9158415632a0463c0c8eed4a49e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Fri, 6 Jan 2023 10:15:20 +0800 Subject: [PATCH] Expansions of some unmaintained pr (#49551) --- paddle/fluid/platform/dynload/tensorrt.cc | 18 ++++++++++++++---- paddle/phi/backends/dynload/tensorrt.cc | 15 +++++++++++++-- python/paddle/tensor/manipulation.py | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/platform/dynload/tensorrt.cc b/paddle/fluid/platform/dynload/tensorrt.cc index d3f3eeadee..b75ef76736 100644 --- a/paddle/fluid/platform/dynload/tensorrt.cc +++ b/paddle/fluid/platform/dynload/tensorrt.cc @@ -41,10 +41,20 @@ void* GetDsoHandle(const std::string& dso_name) { void* dso_handle = dlopen(dso_name.c_str(), dynload_flags); - PADDLE_ENFORCE_NOT_NULL(dso_handle, - paddle::platform::errors::NotFound( - "TensorRT is needed, " - "but TensorRT dynamic library is not found.")); + PADDLE_ENFORCE_NOT_NULL( + dso_handle, + paddle::platform::errors::NotFound( + "TensorRT is needed, " + "but TensorRT dynamic library is not found.\n" + " Suggestions:\n" + " 1. Check if the TensorRT is installed correctly and its version" + " is matched with paddlepaddle you installed.\n" + " 2. Configure environment variables as " + "follows:\n" + " - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`\n" + " - Windows: set PATH by `set PATH=XXX;%PATH%`\n" + " - Mac: set DYLD_LIBRARY_PATH by `export " + "DYLD_LIBRARY_PATH=...`\n")); return dso_handle; } diff --git a/paddle/phi/backends/dynload/tensorrt.cc b/paddle/phi/backends/dynload/tensorrt.cc index 7380788fac..ff4217ce02 100644 --- a/paddle/phi/backends/dynload/tensorrt.cc +++ b/paddle/phi/backends/dynload/tensorrt.cc @@ -42,8 +42,19 @@ void* GetDsoHandle(const std::string& dso_name) { PADDLE_ENFORCE_NOT_NULL( dso_handle, - phi::errors::NotFound("TensorRT is needed, " - "but TensorRT dynamic library is not found.")); + phi::errors::NotFound( + "TensorRT is needed, " + "but TensorRT dynamic library is not found.\n" + " Suggestions:\n" + " 1. Check if the TensorRT is installed correctly and its version" + " is matched with paddlepaddle you installed.\n" + " 2. Configure environment variables as " + "follows:\n" + " - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`\n" + " - Windows: set PATH by `set PATH=XXX;%PATH%`\n" + " - Mac: set DYLD_LIBRARY_PATH by `export " + "DYLD_LIBRARY_PATH=...`\n")); + return dso_handle; } diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index a4f1dc1fb4..70a6d848e1 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -1272,7 +1272,7 @@ def broadcast_tensors(input, name=None): last_index = output_shape_r_last_tensor_index[i] raise TypeError( "Input tensors to broadcast_tensors does not follow bcast semantics" - "Tensor {last_index} conflicts with Tensor {j} in reversed dimension {i}" + f"Tensor {last_index} conflicts with Tensor {j} in reversed dimension {i}" ) if output_shape_r[i] <= shape[i]: output_shape_r[i] = shape[i] -- GitLab