Skip to content

Commit

Permalink
Handle unresolved input everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
bratseth committed Dec 9, 2024
1 parent 1f5c948 commit af5bec0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ else if ( ! embedders.containsKey(embedderId)) {
}

@Override
public DataType setInputType(DataType type, VerificationContext context) {
super.setInputType(type, context);
if ( ! (type == DataType.STRING) &&
! (type instanceof ArrayDataType array && array.getNestedType() == DataType.STRING))
public DataType setInputType(DataType inputType, VerificationContext context) {
super.setInputType(inputType, context);
if ( inputType != null &&
! (inputType == DataType.STRING) &&
! (inputType instanceof ArrayDataType array && array.getNestedType() == DataType.STRING))
throw new VerificationException(this, "This requires either a string or array<string> input type, but got " +
type.getName());
inputType.getName());
return getOutputType(context); // embed cannot determine the output type from the input
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class PackBitsExpression extends Expression {

@Override
public DataType setInputType(DataType inputType, VerificationContext context) {
if (inputType == null) return null;
super.setInputType(inputType, context);
if ( ! validType(inputType))
throw new VerificationException(this, "Require a tensor with one dense dimension, but got " + inputType.getName());
Expand Down

0 comments on commit af5bec0

Please sign in to comment.