blob: 5fba7cc6da0d7ce06dc035ef436fc402598c3215 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.rankingexpression.importer.operations;
import ai.vespa.rankingexpression.importer.OrderedTensorType;
import com.yahoo.tensor.functions.TensorFunction;
import java.util.List;
import java.util.Optional;
import java.util.function.DoubleUnaryOperator;
public class Map extends IntermediateOperation {
private final DoubleUnaryOperator operator;
public Map(String modelName, String nodeName, List<IntermediateOperation> inputs, DoubleUnaryOperator operator) {
super(modelName, nodeName, inputs);
this.operator = operator;
}
@Override
protected OrderedTensorType lazyGetType() {
if (!allInputTypesPresent(1)) {
return null;
}
return inputs.get(0).type().get();
}
@Override
protected TensorFunction lazyGetFunction() {
if (!allInputFunctionsPresent(1)) {
return null;
}
Optional<TensorFunction> input = inputs.get(0).function();
return new com.yahoo.tensor.functions.Map(input.get(), operator);
}
@Override
public String toString() {
return "Map(" + asString(inputs().get(0).type()) + ", " + operator + ")";
}
@Override
public String toFullString() {
return "\t" + lazyGetType() + "\tMap(" + inputs().get(0).toFullString() + ", " + operator + ")";
}
}
|