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

org.nd4j.autodiff.samediff.ArrayHolder Maven / Gradle / Ivy

There is a newer version: 1.0.0-M2.1
Show newest version
package org.nd4j.autodiff.samediff;

import org.nd4j.linalg.api.ndarray.INDArray;

import java.util.Collection;

/**
 * Holds a set of arrays keyed by a String name, functioning essentially like a {@code Map}.
* Implementations may have different internal ways of storing arrays, however.
* For example for single threaded applications: {@link org.nd4j.autodiff.samediff.array.SingleThreadArrayHolder}
* And for multi-threaded: {@link org.nd4j.autodiff.samediff.array.ThreadSafeArrayHolder} * * @author Alex Black */ public interface ArrayHolder { /** * @return True if an array by that name exists */ boolean hasArray(String name); /** * @param name Name of the array to get * @return The array, or null if no array with that name exists */ INDArray getArray(String name); /** * Set the array for the specified name (new array, or replace if it already exists) * * @param name Name of the array * @param array Array to set */ void setArray(String name, INDArray array); /** * Remove the array from the ArrayHolder, returning it (if it exists) * * @param name Name of the array to return * @return The now-removed array */ INDArray removeArray(String name); /** * @return Number of arrays in the ArrayHolder */ int size(); /** * Initialize from the specified array holder. * This clears all internal arrays, and adds all arrays from the specified array holder * * @param arrayHolder Array holder to initialize this based on */ void initFrom(ArrayHolder arrayHolder); /** * @return Names of the arrays currently in the ArrayHolder */ Collection arrayNames(); /** * Rename the entry with the specified name * * @param from Original name * @param to New name */ void rename(String from, String to); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy