diff --git a/api/src/main/java/ai/djl/nn/AbstractBlock.java b/api/src/main/java/ai/djl/nn/AbstractBlock.java index 2613976f679..6924c1788d4 100644 --- a/api/src/main/java/ai/djl/nn/AbstractBlock.java +++ b/api/src/main/java/ai/djl/nn/AbstractBlock.java @@ -330,6 +330,9 @@ protected void prepare(Shape[] inputShapes) {} /** {@inheritDoc} */ @Override public boolean isInitialized() { + if (inputShapes == null) { + return false; + } for (Parameter param : getParameters().values()) { if (!param.isInitialized()) { return false;