Search in sources :

Example 6 with TensorValue

use of com.yahoo.searchlib.rankingexpression.evaluation.TensorValue in project vespa by vespa-engine.

the class TestableTensorFlowModel method assertEqualResult.

public void assertEqualResult(String inputName, String operationName) {
    Tensor tfResult = tensorFlowExecute(tensorFlowModel, inputName, operationName);
    Context context = contextFrom(model);
    Tensor placeholder = placeholderArgument();
    context.put(inputName, new TensorValue(placeholder));
    model.macros().forEach((k, v) -> evaluateMacro(context, model, k));
    Tensor vespaResult = model.expressions().get(operationName).evaluate(context).asTensor();
    assertEquals("Operation '" + operationName + "' produces equal results", tfResult, vespaResult);
}
Also used : Context(com.yahoo.searchlib.rankingexpression.evaluation.Context) MapContext(com.yahoo.searchlib.rankingexpression.evaluation.MapContext) TensorValue(com.yahoo.searchlib.rankingexpression.evaluation.TensorValue) Tensor(com.yahoo.tensor.Tensor)

Example 7 with TensorValue

use of com.yahoo.searchlib.rankingexpression.evaluation.TensorValue in project vespa by vespa-engine.

the class TensorConformanceTest method getInput.

private MapContext getInput(JsonNode inputs) {
    MapContext context = new MapContext();
    for (Iterator<String> i = inputs.fieldNames(); i.hasNext(); ) {
        String name = i.next();
        String value = inputs.get(name).asText();
        Tensor tensor = getTensor(value);
        context.put(name, new TensorValue(tensor));
    }
    return context;
}
Also used : TensorValue(com.yahoo.searchlib.rankingexpression.evaluation.TensorValue) Tensor(com.yahoo.tensor.Tensor) MapContext(com.yahoo.searchlib.rankingexpression.evaluation.MapContext)

Aggregations

TensorValue (com.yahoo.searchlib.rankingexpression.evaluation.TensorValue)7 MapContext (com.yahoo.searchlib.rankingexpression.evaluation.MapContext)3 Tensor (com.yahoo.tensor.Tensor)3 Value (com.yahoo.searchlib.rankingexpression.evaluation.Value)2 RankingExpression (com.yahoo.searchlib.rankingexpression.RankingExpression)1 Context (com.yahoo.searchlib.rankingexpression.evaluation.Context)1 OrderedTensorType (com.yahoo.searchlib.rankingexpression.integration.tensorflow.importer.OrderedTensorType)1 NameNode (com.yahoo.searchlib.rankingexpression.rule.NameNode)1 ReferenceNode (com.yahoo.searchlib.rankingexpression.rule.ReferenceNode)1 IndexedTensor (com.yahoo.tensor.IndexedTensor)1