Package ai.vespa.models.evaluation
Class LazyArrayContext
java.lang.Object
com.yahoo.searchlib.rankingexpression.evaluation.Context
ai.vespa.models.evaluation.LazyArrayContext
- All Implemented Interfaces:
com.yahoo.searchlib.rankingexpression.evaluation.ContextIndex,com.yahoo.tensor.evaluation.EvaluationContext<com.yahoo.searchlib.rankingexpression.Reference>,com.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>
public final class LazyArrayContext
extends com.yahoo.searchlib.rankingexpression.evaluation.Context
implements com.yahoo.searchlib.rankingexpression.evaluation.ContextIndex
An array context supporting functions invocations implemented as lazy values.
- Author:
- bratseth
-
Method Summary
Modifier and TypeMethodDescriptionReturns the (immutable) subset of names in this which must be bound when invokingcom.yahoo.searchlib.rankingexpression.evaluation.ValueReturns the value which should be used when no value is setcom.yahoo.searchlib.rankingexpression.evaluation.Valueget(int index) Perform a fast lookup by indexcom.yahoo.searchlib.rankingexpression.evaluation.ValuePerform a slow lookup by namedoublegetDouble(int index) intcom.yahoo.tensor.TensorTypegetType(com.yahoo.searchlib.rankingexpression.Reference reference) names()Returns the set of ONNX models that need to be evaluated on this contextfinal voidput(int index, double value) Same as put(index,DoubleValue.frozen(value))voidput(int index, com.yahoo.searchlib.rankingexpression.evaluation.Value value) Puts a value by index.voidPuts a value by name.resolveBinding(String argument) voidsetMissingValue(com.yahoo.tensor.Tensor value) Sets the value to use for lookups to existing values which are not set in this context.intsize()Methods inherited from class com.yahoo.searchlib.rankingexpression.evaluation.Context
get, getTensor, getType, put
-
Method Details
-
setMissingValue
public void setMissingValue(com.yahoo.tensor.Tensor value) Sets the value to use for lookups to existing values which are not set in this context. The default value that will be returned is NaN -
put
Puts a value by name. The value will be frozen if it isn't already.- Overrides:
putin classcom.yahoo.searchlib.rankingexpression.evaluation.Context- Throws:
IllegalArgumentException- if the name is not present in the ranking expression this was created with, and ignoredUnknownValues is false
-
put
public final void put(int index, double value) Same as put(index,DoubleValue.frozen(value)) -
put
public void put(int index, com.yahoo.searchlib.rankingexpression.evaluation.Value value) Puts a value by index. The value will be frozen if it isn't already. -
getType
public com.yahoo.tensor.TensorType getType(com.yahoo.searchlib.rankingexpression.Reference reference) - Specified by:
getTypein interfacecom.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>
-
get
Perform a slow lookup by name- Specified by:
getin classcom.yahoo.searchlib.rankingexpression.evaluation.Context
-
get
public com.yahoo.searchlib.rankingexpression.evaluation.Value get(int index) Perform a fast lookup by index- Specified by:
getin interfacecom.yahoo.searchlib.rankingexpression.evaluation.ContextIndex- Overrides:
getin classcom.yahoo.searchlib.rankingexpression.evaluation.Context
-
getDouble
public double getDouble(int index) - Specified by:
getDoublein interfacecom.yahoo.searchlib.rankingexpression.evaluation.ContextIndex- Overrides:
getDoublein classcom.yahoo.searchlib.rankingexpression.evaluation.Context
-
getIndex
- Specified by:
getIndexin interfacecom.yahoo.searchlib.rankingexpression.evaluation.ContextIndex
-
resolveBinding
- Specified by:
resolveBindingin interfacecom.yahoo.tensor.evaluation.TypeContext<com.yahoo.searchlib.rankingexpression.Reference>
-
size
public int size()- Specified by:
sizein interfacecom.yahoo.searchlib.rankingexpression.evaluation.ContextIndex
-
names
- Overrides:
namesin classcom.yahoo.searchlib.rankingexpression.evaluation.Context
-
arguments
Returns the (immutable) subset of names in this which must be bound when invoking -
onnxModels
Returns the set of ONNX models that need to be evaluated on this context -
defaultValue
public com.yahoo.searchlib.rankingexpression.evaluation.Value defaultValue()Returns the value which should be used when no value is set
-