public Tensor convertTo(TensorType type, String key, Object value, Language language,
                            Map<String, String> contextValues, Properties properties) {
        var context = new Embedder.Context(key).setLanguage(language);
        Tensor tensor = toTensor(type, value, context, contextValues, properties);
        if (tensor == null) return null;
        if (! tensor.type().isAssignableTo(type))
            throw new IllegalArgumentException("Require a tensor of type " + type);
        return tensor;
    }
A class which knows how to convert an Object value to a tensor of a given type.

@author bratseth
container-search/src/main/java/com/yahoo/search/schema/internal/TensorConverter.java