Skip to content

Commit 80a5d1c

Browse files
committed
Fix for SavedModelBundle to load empty tags as these are present in some TF-hub models.
1 parent 788b4da commit 80a5d1c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/SavedModelBundle.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.LinkedHashMap;
3030
import java.util.List;
3131
import java.util.Map;
32+
import java.util.Objects;
3233
import java.util.stream.Collectors;
3334
import org.bytedeco.javacpp.BytePointer;
3435
import org.bytedeco.javacpp.PointerScope;
@@ -432,7 +433,7 @@ private static SavedModelBundle load(
432433
}
433434

434435
private static void validateTags(String[] tags) {
435-
if (tags == null || Arrays.stream(tags).anyMatch(t -> t == null || t.isEmpty())) {
436+
if (tags == null || Arrays.stream(tags).anyMatch(Objects::isNull)) {
436437
throw new IllegalArgumentException("Invalid tags: " + Arrays.toString(tags));
437438
}
438439
}

0 commit comments

Comments
 (0)