Repository: deepjavalibrary/djl
Pull request #2121 (2022-11-02 22:07:31)

[TF] tensorflow upgrade
## Description ##

Upgrade TF version


codecov-commenter: # [Codecov](https://codecov.io/gh/deepjavalibrary/djl/pull/2121?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) Report
Base: **72.08**% // Head: **71.33**% // Decreases project coverage by **`-0.75%`** :warning:
> Coverage data is based on head [(`e389555`)](https://codecov.io/gh/deepjavalibrary/djl/pull/2121?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) compared to base [(`bb5073f`)](https://codecov.io/gh/deepjavalibrary/djl/commit/bb5073f7ffc33f1883621fc1783dbb01e70b418f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary).
> Patch coverage: 71.54% of modified lines in pull request are covered.

<details><summary>Additional details and impacted files</summary>


```diff
@@             Coverage Diff              @@
##             master    #2121      +/-   ##
============================================
- Coverage     72.08%   71.33%   -0.76%     
- Complexity     5126     6282    +1156     
============================================
  Files           473      624     +151     
  Lines         21970    27823    +5853     
  Branches       2351     3000     +649     
============================================
+ Hits          15838    19847    +4009     
- Misses         4925     6516    +1591     
- Partials       1207     1460     +253     
```


| [Impacted Files](https://codecov.io/gh/deepjavalibrary/djl/pull/2121?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) | Coverage Δ | |
|---|---|---|
| [api/src/main/java/ai/djl/modality/cv/Image.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L0ltYWdlLmphdmE=) | `69.23% <ø> (-4.11%)` | :arrow_down: |
| [...rc/main/java/ai/djl/modality/cv/MultiBoxPrior.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L011bHRpQm94UHJpb3IuamF2YQ==) | `76.00% <ø> (ø)` | |
| [...rc/main/java/ai/djl/modality/cv/output/Joints.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9Kb2ludHMuamF2YQ==) | `71.42% <ø> (ø)` | |
| [.../main/java/ai/djl/modality/cv/output/Landmark.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9MYW5kbWFyay5qYXZh) | `100.00% <ø> (ø)` | |
| [...main/java/ai/djl/modality/cv/output/Rectangle.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9SZWN0YW5nbGUuamF2YQ==) | `72.41% <0.00%> (ø)` | |
| [...i/djl/modality/cv/translator/BigGANTranslator.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvQmlnR0FOVHJhbnNsYXRvci5qYXZh) | `21.42% <0.00%> (-5.24%)` | :arrow_down: |
| [.../modality/cv/translator/ImageFeatureExtractor.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvSW1hZ2VGZWF0dXJlRXh0cmFjdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [.../ai/djl/modality/cv/translator/YoloTranslator.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvWW9sb1RyYW5zbGF0b3IuamF2YQ==) | `27.77% <0.00%> (+18.95%)` | :arrow_up: |
| [...modality/cv/translator/wrapper/FileTranslator.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3Ivd3JhcHBlci9GaWxlVHJhbnNsYXRvci5qYXZh) | `44.44% <ø> (ø)` | |
| [...y/cv/translator/wrapper/InputStreamTranslator.java](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3Ivd3JhcHBlci9JbnB1dFN0cmVhbVRyYW5zbGF0b3IuamF2YQ==) | `44.44% <ø> (ø)` | |
| ... and [558 more](https://codecov.io/gh/deepjavalibrary/djl/pull/2121/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/deepjavalibrary/djl/pull/2121?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary).


Patch:
diff --git a/.github/workflows/continuous.yml b/.github/workflows/continuous.yml
index 1ccd4dfd7..a1264ff06 100644
--- a/.github/workflows/continuous.yml
+++ b/.github/workflows/continuous.yml
@@ -17,7 +17,7 @@ jobs:
     runs-on: ${{ matrix.operating-system }}
     strategy:
       matrix:
-        operating-system: [ ubuntu-18.04, macos-latest ]
+        operating-system: [ ubuntu-18.04, macos-12 ]
 
     steps:
       - uses: actions/checkout@v3
@@ -52,13 +52,13 @@ jobs:
       - name: Build with Gradle
         run: ./gradlew build jRR jRV
       - name: Upload test results
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         if: always()
         with:
           name: reports
           path: ${{ github.workspace }}/**/build/reports/**/*
       - name: upload to codecov
-        uses: codecov/codecov-action@v1.5.0
+        uses: codecov/codecov-action@v3
         with:
           files: ./build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml
           fail_ci_if_error: false
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 25cfba51f..f57bd3454 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -21,7 +21,7 @@ jobs:
           distribution: 'corretto'
           java-version: 11
       - name: Set up Python3
-        uses: actions/setup-python@v1
+        uses: actions/setup-python@v3
         with:
           python-version: '3.x'
       - name: Install CN fonts
diff --git a/.github/workflows/native_build_mxnet_osx.yml b/.github/workflows/native_build_mxnet_osx.yml
index d587c09a6..4728ea175 100644
--- a/.github/workflows/native_build_mxnet_osx.yml
+++ b/.github/workflows/native_build_mxnet_osx.yml
@@ -23,7 +23,7 @@ jobs:
           clang --version
           CMAKE_STATICBUILD=1 ./tools/staticbuild/build.sh cpu
       - name: Upload libmxnet.dylib
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         with:
           name: libmxnet.dylib
           path: build/libmxnet.dylib
diff --git a/.github/workflows/native_jni_s3_paddle.yml b/.github/workflows/native_jni_s3_paddle.yml
index 45e6d0fc4..bf01c00d6 100644
--- a/.github/workflows/native_jni_s3_paddle.yml
+++ b/.github/workflows/native_jni_s3_paddle.yml
@@ -29,7 +29,7 @@ jobs:
       - name: Release JNI prep
         run: ./gradlew :engines:paddlepaddle:paddlepaddle-native:compileJNI
       - name: Upload compiled jni library
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         if: always()
         with:
           name: jnilib-${{ runner.os }}
@@ -70,7 +70,7 @@ jobs:
         run: |
           ./gradlew :engines:paddlepaddle:paddlepaddle-native:compileJNI
       - name: Upload compiled jni library
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         if: always()
         with:
           name: jnilib-${{ runner.os }}
@@ -83,17 +83,17 @@ jobs:
     steps:
       - uses: actions/checkout@v3
       - name: Download compiledJNI Mac
-        uses: actions/download-artifact@v1
+        uses: actions/download-artifact@v3
         with:
           name: jnilib-macOS
           path: jnilib
       - name: Download compiledJNI Windows
-        uses: actions/download-artifact@v1
+        uses: actions/download-artifact@v3
         with:
           name: jnilib-Windows
           path: jnilib
       - name: Download compiledJNI Linux CPU
-        uses: actions/download-artifact@v1
+        uses: actions/download-artifact@v3
         with:
           name: jnilib-Linux
           path: jnilib
diff --git a/.github/workflows/native_s3_tflite.yml b/.github/workflows/native_s3_tflite.yml
index 847606e99..8b8749a86 100644
--- a/.github/workflows/native_s3_tflite.yml
+++ b/.github/workflows/native_s3_tflite.yml
@@ -23,7 +23,7 @@ jobs:
           distribution: 'corretto'
           java-version: 11
       - name: Set up Python3
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: '3.7'
       - name: install Python Dependencies
diff --git a/.github/workflows/nightly_publish.yml b/.github/workflows/nightly_publish.yml
index 4f932a4d0..63e4313dc 100644
--- a/.github/workflows/nightly_publish.yml
+++ b/.github/workflows/nightly_publish.yml
@@ -37,7 +37,7 @@ jobs:
       - name: Build with Gradle
         run: ./gradlew -Dnightly=true build jRR jRV
       - name: Upload test results
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         if: always()
         with:
           name: reports
@@ -75,14 +75,14 @@ jobs:
         operating-system: [ macos-latest, ubuntu-18.04, windows-latest ]
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
       - name: Set up JDK 11
         uses: actions/setup-java@v3
         with:
           distribution: 'corretto'
           java-version: 11
       # Enable gradle cache: https://github.com/actions/cache/blob/master/examples.md#java---gradle
-      - uses: actions/cache@v1
+      - uses: actions/cache@v3
         with:
           path: ~/.gradle/caches
           key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
@@ -109,7 +109,7 @@ jobs:
           java-version: 11
           distribution: corretto
           architecture: aarch64
-      - uses: actions/cache@v1
+      - uses: actions/cache@v3
         with:
           path: ~/.gradle/caches
           key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
@@ -144,7 +144,7 @@ jobs:
         with:
           java-version: 11
           distribution: corretto
-      - uses: actions/cache@v1
+      - uses: actions/cache@v3
         with:
           path: ~/.gradle/caches
           key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
@@ -182,7 +182,7 @@ jobs:
         with:
           java-version: 11
           distribution: corretto
-      - uses: actions/cache@v1
+      - uses: actions/cache@v3
         with:
           path: ~/.gradle/caches
           key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
diff --git a/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/engine/PpModel.java b/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/engine/PpModel.java
index c6008725a..9809e4202 100644
--- a/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/engine/PpModel.java
+++ b/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/engine/PpModel.java
@@ -94,6 +94,12 @@ public class PpModel extends BaseModel {
                 JniUtils.switchIrOptim(
                         config, ArgumentsUtil.booleanValue(options, "SwitchIrOptim"));
             }
+            if (options.containsKey("enableONNXRuntime")) {
+                JniUtils.enableONNXRuntime(config);
+            }
+            if (options.containsKey("enableOrtOptimization")) {
+                JniUtils.enableOrtOptimization(config);
+            }
         }
         paddlePredictor = new PaddlePredictor(JniUtils.createPredictor(config));
         JniUtils.deleteConfig(config);
diff --git a/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/JniUtils.java b/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/JniUtils.java
index c3651a347..4d92610a4 100644
--- a/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/JniUtils.java
+++ b/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/JniUtils.java
@@ -107,6 +107,14 @@ public final class JniUtils {
         PaddleLibrary.LIB.useFeedFetchOp(config);
     }
 
+    public static void enableONNXRuntime(long config) {
+        PaddleLibrary.LIB.analysisConfigEnableONNXRuntime(config);
+    }
+
+    public static void enableOrtOptimization(long config) {
+        PaddleLibrary.LIB.analysisConfigEnableORTOptimization(config);
+    }
+
     public static void deleteConfig(long config) {
         PaddleLibrary.LIB.deleteAnalysisConfig(config);
     }
diff --git a/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/LibUtils.java b/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/LibUtils.java
index 16249b3c9..b8d563719 100644
--- a/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/LibUtils.java
+++ b/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/LibUtils.java
@@ -70,6 +70,8 @@ public final class LibUtils {
             loadLinuxDependencies(libName);
         } else if (System.getProperty("os.name").startsWith("Win")) {
             loadWindowsDependencies(libName);
+        } else if (System.getProperty("os.name").startsWith("Mac")) {
+            loadMacOsDependencies(libName);
         }
         logger.debug("Now loading " + libName);
         System.load(libName); // NOPMD
@@ -91,7 +93,13 @@ public final class LibUtils {
                             + libDir
                             + ", the current one is set to: "
                             + Utils.getenv("LD_LIBRARY_PATH"));
-            List<String> names = Arrays.asList("libdnnl.so.2", "libiomp5.so", "libmklml_intel.so");
+            List<String> names =
+                    Arrays.asList(
+                            "libdnnl.so.2",
+                            "libiomp5.so",
+                            "libmklml_intel.so",
+                            "libonnxruntime.so",
+                            "libpaddle2onnx.so");
             names.forEach(
                     name -> {
                         Path path = libDir.resolve(name);
@@ -108,7 +116,24 @@ public final class LibUtils {
 
     public static void loadWindowsDependencies(String libName) {
         Path libDir = Paths.get(libName).getParent();
-        List<String> names = Arrays.asList("openblas.dll", "mkldnn.dll");
+        List<String> names =
+                Arrays.asList("openblas.dll", "mkldnn.dll", "onnxruntime.dll", "paddle2onnx.dll");
+        names.forEach(
+                name -> {
+                    Path path = libDir.resolve(name);
+                    if (Files.isRegularFile(path)) {
+                        String lib = path.toAbsolutePath().toString();
+                        logger.debug("Now loading " + lib);
+                        System.load(lib);
+                    } else {
+                        logger.debug(name + " is not found, skip loading...");
+                    }
+                });
+    }
+
+    public static void loadMacOsDependencies(String libName) {
+        Path libDir = Paths.get(libName).getParent();
+        List<String> names = Arrays.asList("libonnxruntime.dylib", "libpaddle2onnx.dylib");
         names.forEach(
                 name -> {
                     Path path = libDir.resolve(name);
diff --git a/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/PaddleLibrary.java b/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/PaddleLibrary.java
index f2a4f41e6..b4f9904f1 100644
--- a/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/PaddleLibrary.java
+++ b/engines/paddlepaddle/paddlepaddle-engine/src/main/java/ai/djl/paddlepaddle/jni/PaddleLibrary.java
@@ -54,6 +54,10 @@ final class PaddleLibrary {
 
     native void analysisConfigRemovePass(long handle, String pass);
 
+    native void analysisConfigEnableONNXRuntime(long handle);
+
+    native void analysisConfigEnableORTOptimization(long handle);
+
     native void useFeedFetchOp(long handle);
 
     native void deleteAnalysisConfig(long handle);
diff --git a/engines/paddlepaddle/paddlepaddle-native/build.cmd b/engines/paddlepaddle/paddlepaddle-native/build.cmd
index 992e269b6..2f7ae5a37 100644
--- a/engines/paddlepaddle/paddlepaddle-native/build.cmd
+++ b/engines/paddlepaddle/paddlepaddle-native/build.cmd
@@ -7,9 +7,9 @@
 set FILEPATH="paddle"
 
 if "%1" == "cpu" (
-  set DOWNLOAD_URL="https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Windows/CPU/x86-64_vs2017_avx_openblas/paddle_inference.zip"
-) else if "%1" == "cu110" (
-  set DOWNLOAD_URL="https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Windows/GPU/x86-64_vs2017_avx_mkl_cuda11.0_cudnn8/paddle_inference.zip"
+  set DOWNLOAD_URL="https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Windows/CPU/x86-64_avx-openblas-vs2017/paddle_inference.zip"
+) else if "%1" == "cu112" (
+  set DOWNLOAD_URL="https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Windows/GPU/x86-64_cuda11.2_cudnn8.2.1_trt8.0.1.6_mkl_avx_vs2019/paddle_inference.zip"
 )
 
 if exist %FILEPATH% (
diff --git a/engines/paddlepaddle/paddlepaddle-native/build.gradle b/engines/paddlepaddle/paddlepaddle-native/build.gradle
index 11dbd1b60..f73193a97 100644
--- a/engines/paddlepaddle/paddlepaddle-native/build.gradle
+++ b/engines/paddlepaddle/paddlepaddle-native/build.gradle
@@ -53,12 +53,12 @@ task prepareNativeLibs() {
         delete "${buildDir}/native"
 
         def files = [
-                "cpu/linux"  : "https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Linux/CPU/gcc5.4_avx_openblas/paddle_inference.tgz",
-                "cu102/linux": "https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Linux/GPU/x86-64_gcc5.4_avx_mkl_cuda10.2_cudnn8.1.1_trt7.2.3.4/paddle_inference.tgz",
-                "cu112/linux": "https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Linux/GPU/x86-64_gcc5.4_avx_mkl_cuda11.2_cudnn8.2.1_trt8.0.3.4/paddle_inference.tgz",
-                "cpu/osx"    : "https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/MacOS/CPU/x86-64_clang_avx_openb/paddle_inference_install_dir.tgz",
-                "cpu/win"    : "https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Windows/CPU/x86-64_vs2017_avx_openblas/paddle_inference.zip",
-                "cu110/win"  : "https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Windows/GPU/x86-64_vs2017_avx_mkl_cuda11.0_cudnn8/paddle_inference.zip"
+                "cpu/linux"  : "https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Linux/CPU/gcc5.4_avx_openblas/paddle_inference.tgz",
+                "cu102/linux": "https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Linux/GPU/x86-64_gcc5.4_avx_mkl_cuda10.2_cudnn8.1.1_trt7.2.3.4/paddle_inference.tgz",
+                "cu112/linux": "https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Linux/GPU/x86-64_gcc5.4_avx_mkl_cuda11.2_cudnn8.2.1_trt8.0.3.4/paddle_inference.tgz",
+                "cpu/osx"    : "https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/MacOS/CPU/x86-64_clang_avx_openblas/paddle_inference_install_dir.tgz",
+                "cpu/win"    : "https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Windows/CPU/x86-64_avx-openblas-vs2017/paddle_inference.zip",
+                "cu112/win"  : "https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Windows/GPU/x86-64_cuda11.2_cudnn8.2.1_trt8.0.1.6_mkl_avx_vs2019/paddle_inference.zip"
         ]
 
         def downloadDir = file("${buildDir}/download")
@@ -124,7 +124,7 @@ task uploadS3 {
                 "${buildDir}/native/cu112/linux/native/lib/",
                 "${buildDir}/native/cpu/osx/native/lib/",
                 "${buildDir}/native/cpu/win/native/lib/",
-                "${buildDir}/native/cu110/win/native/lib/"
+                "${buildDir}/native/cu112/win/native/lib/"
         ]
         uploadDirs.each { item ->
             fileTree(item).files.name.each {
diff --git a/engines/paddlepaddle/paddlepaddle-native/build.sh b/engines/paddlepaddle/paddlepaddle-native/build.sh
index b51845005..74fd416a6 100755
--- a/engines/paddlepaddle/paddlepaddle-native/build.sh
+++ b/engines/paddlepaddle/paddlepaddle-native/build.sh
@@ -14,21 +14,21 @@ pushd $WORK_DIR
 
 echo "Trying to find paddle folder..."
 
-# https://www.paddlepaddle.org.cn/inference/v2.2/user_guides/download_lib.html 2.2.2
+# https://www.paddlepaddle.org.cn/inference/v2.3/user_guides/download_lib.html 2.3.2
 
 if [[ ! -d "paddle" ]]; then
   echo "Folder not found. Downloading C++ package..."
   if [[ $PLATFORM == 'linux' ]]; then
     if [[ $1 == "cpu" ]]; then
-      curl -s https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Linux/CPU/gcc5.4_avx_openblas/paddle_inference.tgz -o paddle.tgz
+      curl -s https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Linux/CPU/gcc5.4_avx_openblas/paddle_inference.tgz -o paddle.tgz
       tar -xvzf paddle.tgz
       mv paddle_inference paddle
     elif [[ $1 == "cu102" ]]; then
-      curl -s https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Linux/GPU/x86-64_gcc5.4_avx_mkl_cuda10.2_cudnn7.6.5_trt6.0.1.5/paddle_inference.tgz -o paddle.tgz
+      curl -s https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Linux/GPU/x86-64_gcc5.4_avx_mkl_cuda10.2_cudnn7.6.5_trt6.0.1.5/paddle_inference.tgz -o paddle.tgz
         tar -xvzf paddle.tgz
         mv paddle_inference paddle
     elif [[ $1 == "cu112" ]]; then
-      curl -s https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Linux/GPU/x86-64_gcc5.4_avx_mkl_cuda11.2_cudnn8.2.1_trt8.0.3.4/paddle_inference.tgz -o paddle.tgz
+      curl -s https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/Linux/GPU/x86-64_gcc5.4_avx_mkl_cuda11.2_cudnn8.2.1_trt8.0.3.4/paddle_inference.tgz -o paddle.tgz
         tar -xvzf paddle.tgz
         mv paddle_inference paddle
     else
@@ -36,7 +36,7 @@ if [[ ! -d "paddle" ]]; then
       exit 1
     fi
   elif [[ $PLATFORM == 'darwin' ]]; then
-    curl -s https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/MacOS/CPU/x86-64_clang_avx_openb/paddle_inference_install_dir.tgz -o paddle.tgz
+    curl -s https://paddle-inference-lib.bj.bcebos.com/2.3.2/cxx_c/MacOS/CPU/x86-64_clang_avx_openblas/paddle_inference_install_dir.tgz -o paddle.tgz
     tar -xvzf paddle.tgz
     mv paddle_inference_install_dir paddle
   else
diff --git a/engines/paddlepaddle/paddlepaddle-native/src/main/native/ai_djl_paddlepaddle_jni_PaddleLibrary_inference.cc b/engines/paddlepaddle/paddlepaddle-native/src/main/native/ai_djl_paddlepaddle_jni_PaddleLibrary_inference.cc
index 5b32d19d6..e1b78545d 100644
--- a/engines/paddlepaddle/paddlepaddle-native/src/main/native/ai_djl_paddlepaddle_jni_PaddleLibrary_inference.cc
+++ b/engines/paddlepaddle/paddlepaddle-native/src/main/native/ai_djl_paddlepaddle_jni_PaddleLibrary_inference.cc
@@ -81,6 +81,18 @@ JNIEXPORT void JNICALL Java_ai_djl_paddlepaddle_jni_PaddleLibrary_analysisConfig
   config_ptr->pass_builder()->DeletePass(djl::utils::jni::GetStringFromJString(env, jpass));
 }
 
+JNIEXPORT void JNICALL Java_ai_djl_paddlepaddle_jni_PaddleLibrary_analysisConfigEnableONNXRuntime
+        (JNIEnv* env, jobject jthis, jlong jhandle) {
+    auto* config_ptr = reinterpret_cast<paddle::AnalysisConfig*>(jhandle);
+    config_ptr->EnableONNXRuntime();
+}
+
+JNIEXPORT void JNICALL Java_ai_djl_paddlepaddle_jni_PaddleLibrary_analysisConfigEnableORTOptimization
+        (JNIEnv* env, jobject jthis, jlong jhandle) {
+    auto* config_ptr = reinterpret_cast<paddle::AnalysisConfig*>(jhandle);
+    config_ptr->EnableORTOptimization();
+}
+
 JNIEXPORT void JNICALL Java_ai_djl_paddlepaddle_jni_PaddleLibrary_deleteAnalysisConfig(
     JNIEnv* env, jobject jthis, jlong jhandle) {
   const auto* config_ptr = reinterpret_cast<paddle::AnalysisConfig*>(jhandle);
diff --git a/engines/tensorflow/tensorflow-api/build.gradle b/engines/tensorflow/tensorflow-api/build.gradle
index 5e564e128..b7c6c9934 100644
--- a/engines/tensorflow/tensorflow-api/build.gradle
+++ b/engines/tensorflow/tensorflow-api/build.gradle
@@ -7,7 +7,7 @@ configurations {
 dependencies {
     api "org.bytedeco:javacpp:${javacpp_version}"
     api "com.google.protobuf:protobuf-java:${protobuf_version}"
-    api "org.tensorflow:tensorflow-core-api:0.4.0"
+    api "org.tensorflow:tensorflow-core-api:0.4.2"
 
     exclusion "org.bytedeco:javacpp:${javacpp_version}"
     exclusion "com.google.protobuf:protobuf-java:${protobuf_version}"
diff --git a/engines/tensorflow/tensorflow-native/build.gradle b/engines/tensorflow/tensorflow-native/build.gradle
index 45066a6b9..d72e52dc0 100644
--- a/engines/tensorflow/tensorflow-native/build.gradle
+++ b/engines/tensorflow/tensorflow-native/build.gradle
@@ -13,11 +13,11 @@ configurations {
 }
 
 dependencies {
-    download "org.tensorflow:tensorflow-core-api:0.4.0:linux-x86_64-gpu"
-    download "org.tensorflow:tensorflow-core-api:0.4.0:linux-x86_64"
-    download "org.tensorflow:tensorflow-core-api:0.4.0:macosx-x86_64"
-    download "org.tensorflow:tensorflow-core-api:0.4.0:windows-x86_64"
-    download "org.tensorflow:tensorflow-core-api:0.4.0:windows-x86_64-gpu"
+    download "org.tensorflow:tensorflow-core-api:0.4.2:linux-x86_64-gpu"
+    download "org.tensorflow:tensorflow-core-api:0.4.2:linux-x86_64"
+    download "org.tensorflow:tensorflow-core-api:0.4.2:macosx-x86_64"
+    download "org.tensorflow:tensorflow-core-api:0.4.2:windows-x86_64"
+    download "org.tensorflow:tensorflow-core-api:0.4.2:windows-x86_64-gpu"
 }
 
 task uploadTensorflowNativeLibs() {
diff --git a/gradle.properties b/gradle.properties
index 7f754b706..714988d86 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -14,12 +14,12 @@ systemProp.org.gradle.internal.publish.checksums.insecure=true
 djl_version=0.20.0
 mxnet_version=1.9.1
 pytorch_version=1.12.1
-tensorflow_version=2.7.0
+tensorflow_version=2.7.4
 tflite_version=2.6.2
 dlr_version=1.6.0
 trt_version=8.4.1
 onnxruntime_version=1.13.1
-paddlepaddle_version=2.2.2
+paddlepaddle_version=2.3.2
 sentencepiece_version=0.1.96
 tokenizers_version=0.12.0
 fasttext_version=0.9.2


Test patch:
diff --git a/engines/paddlepaddle/paddlepaddle-model-zoo/src/test/java/ai/djl/paddlepaddle/zoo/MaskDetectionTest.java b/engines/paddlepaddle/paddlepaddle-model-zoo/src/test/java/ai/djl/paddlepaddle/zoo/MaskDetectionTest.java
index 8545d0df0..62e1bd1e6 100644
--- a/engines/paddlepaddle/paddlepaddle-model-zoo/src/test/java/ai/djl/paddlepaddle/zoo/MaskDetectionTest.java
+++ b/engines/paddlepaddle/paddlepaddle-model-zoo/src/test/java/ai/djl/paddlepaddle/zoo/MaskDetectionTest.java
@@ -109,6 +109,8 @@ public class MaskDetectionTest {
                         .setTypes(Image.class, Classifications.class)
                         .optArtifactId("ai.djl.paddlepaddle:mask_classification")
                         .optFilter("flavor", "server")
+                        .optOption("enableONNXRuntime", "true")
+                        .optOption("enableOrtOptimization", "true")
                         .build();
         ZooModel<Image, Classifications> model = criteria.loadModel();
         return model.newPredictor();
@@ -121,6 +123,8 @@ public class MaskDetectionTest {
                         .setTypes(Image.class, DetectedObjects.class)
                         .optArtifactId("ai.djl.paddlepaddle:face_detection")
                         .optFilter("flavor", "server")
+                        .optOption("enableONNXRuntime", "true")
+                        .optOption("enableOrtOptimization", "true")
                         .build();
 
         try (ZooModel<Image, DetectedObjects> model = criteria.loadModel();