All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.tensor.functions.CompositeTensorFunction Maven / Gradle / Ivy

Go to download

Library for use in Java components of Vespa. Shared code which do not fit anywhere else.

There is a newer version: 8.409.18
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.tensor.functions;

import com.yahoo.tensor.Tensor;
import com.yahoo.tensor.TensorType;
import com.yahoo.tensor.evaluation.EvaluationContext;
import com.yahoo.tensor.evaluation.Name;
import com.yahoo.tensor.evaluation.TypeContext;

/**
 * A composite tensor function is a tensor function which can be expressed (less tersely)
 * as a tree of primitive tensor functions.
 *
 * @author bratseth
 */
public abstract class CompositeTensorFunction extends TensorFunction {

    /** Finds the type this produces by first converting it to a primitive function */
    @Override
    public TensorType type(TypeContext context) {
        return toPrimitive().type(context);
    }

    /** Evaluates this by first converting it to a primitive function */
    @Override
    public Tensor evaluate(EvaluationContext context) {
        return toPrimitive().evaluate(context);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy