public static List<ScalarFunction<Reference>> wrapScalars(TensorType type,
                                                              List<String> dimensionOrder,
                                                              List<ExpressionNode> nodes) {
        IndexedTensor.Indexes indexes = IndexedTensor.Indexes.of(type, dimensionOrder);
        if (indexes.size() != nodes.size())
            throw new IllegalArgumentException("Need " + indexes.size() + " values to fill " + type + " but got " + nodes.size());

        List<ScalarFunction<Reference>> wrapped = new ArrayList<>(nodes.size());
        for (int i = 0; i < nodes.size(); i++) {
            wrapped.add(null);
        }
        int i = 0;
        while (indexes.hasNext()) {
            indexes.next();
            int idx = (int)indexes.toSourceValueIndex();
            wrapped.set(idx, wrapScalar(nodes.get(i++)));
        }
        return wrapped;
    }
Returns the tensor function wrapped by this
searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/TensorFunctionNode.java