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

com.linkedin.dagli.dag.DAGExecutionResult Maven / Gradle / Ivy

Go to download

DAG-oriented machine learning framework for bug-resistant, readable, efficient, maintainable and trivially deployable models in Java and other JVM languages

There is a newer version: 15.0.0-beta9
Show newest version
package com.linkedin.dagli.dag;

import com.linkedin.dagli.objectio.ObjectReader;
import com.linkedin.dagli.preparer.PreparerResult;
import com.linkedin.dagli.util.array.AutoCloseableArray;
import java.util.Arrays;
import java.util.Objects;


/**
 * This class is used internally by Dagli to store the result of executing a DAG.
 * @param  the type of the result of the DAG (e.g. for a DAG1x2 this would be a Tuple2).
 */
class DAGExecutionResult> implements AutoCloseable {
  private final PreparerResult _preparerResult;
  private final ObjectReader[] _outputs;

  /**
   * Creates a new result.
   *
   * @param preparerResult the prepared DAGs (for new and preparation data)
   * @param outputs the outputs of the DAG; may be null if the executor prepared the DAG but did not generate any
   *                output values
   */
  public DAGExecutionResult(PreparerResult preparerResult, ObjectReader[] outputs) {
    assert outputs == null || Arrays.stream(outputs).noneMatch(Objects::isNull);
    _preparerResult = preparerResult;
    _outputs = outputs;
  }

  public PreparerResult getPreparerResult() {
    return _preparerResult;
  }

  public ObjectReader[] getOutputs() {
    return _outputs;
  }

  @Override
  public void close() {
    AutoCloseableArray.close(_outputs);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy