From e62321088ce41c9cd631a301027e39c778ee1a53 Mon Sep 17 00:00:00 2001 From: Frank Liu Date: Wed, 2 Oct 2024 11:47:09 -0700 Subject: [PATCH] [api] alternative NDArray should not be closed in NDScope (#3490) --- api/src/main/java/ai/djl/ndarray/NDArrayAdapter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/api/src/main/java/ai/djl/ndarray/NDArrayAdapter.java b/api/src/main/java/ai/djl/ndarray/NDArrayAdapter.java index 04ea056b4db..cceb5efd494 100644 --- a/api/src/main/java/ai/djl/ndarray/NDArrayAdapter.java +++ b/api/src/main/java/ai/djl/ndarray/NDArrayAdapter.java @@ -1346,6 +1346,7 @@ private NDArray getAlternativeArray() { } else { alternativeArray.set(getDataType().asDataType(toByteBuffer())); } + NDScope.unregister(alternativeArray); return alternativeArray; } }