public Value evaluateAsConstant(OrderedTensorType type) {
        if ( ! isConstant() ) {
            throw new IllegalArgumentException("Attempted to evaluate non-constant operation as a constant.");
        }
        Value val = evaluableCopy().evaluateAsConstant(new MapContext(DoubleValue.NaN));
        if (type == null) {
            return val;
        }
        Tensor tensor = val.asTensor();
        checkIfRenameableTo(tensor, type);
        setConstantValueFunction(t -> new TensorValue(tensor.withType(t.type())));  // so we don't have to re-evaluate
        return new TensorValue(tensor.withType(type.type()));
    }
Recursively evaluates this operation's constant value to avoid doing it run-time.
model-integration/src/main/java/ai/vespa/rankingexpression/importer/operations/IntermediateOperation.java