Package org.nd4j.autodiff.samediff.array
Class OptimizedGraphArrayHolder
- java.lang.Object
-
- org.nd4j.autodiff.samediff.array.OptimizedGraphArrayHolder
-
- All Implemented Interfaces:
ArrayHolder
public class OptimizedGraphArrayHolder extends Object implements ArrayHolder
-
-
Constructor Summary
Constructors Constructor Description OptimizedGraphArrayHolder(ArrayHolder underlyingHolder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<String>arrayNames()INDArraygetArray(String name)booleanhasArray(String name)voidinitFrom(ArrayHolder arrayHolder)Initialize from the specified array holder.INDArrayremoveArray(String name)Remove the array from the ArrayHolder, returning it (if it exists)voidrename(String from, String to)Rename the entry with the specified namevoidsetArray(String name, INDArray array)Set the array for the specified name (new array, or replace if it already exists)voidsetFunction(String name, Supplier<INDArray> fn)intsize()
-
-
-
Constructor Detail
-
OptimizedGraphArrayHolder
public OptimizedGraphArrayHolder(ArrayHolder underlyingHolder)
-
-
Method Detail
-
hasArray
public boolean hasArray(String name)
- Specified by:
hasArrayin interfaceArrayHolder- Returns:
- True if an array by that name exists
-
getArray
public INDArray getArray(String name)
- Specified by:
getArrayin interfaceArrayHolder- Parameters:
name- Name of the array to get- Returns:
- The array, or null if no array with that name exists
-
setArray
public void setArray(String name, INDArray array)
Description copied from interface:ArrayHolderSet the array for the specified name (new array, or replace if it already exists)- Specified by:
setArrayin interfaceArrayHolder- Parameters:
name- Name of the arrayarray- Array to set
-
removeArray
public INDArray removeArray(String name)
Description copied from interface:ArrayHolderRemove the array from the ArrayHolder, returning it (if it exists)- Specified by:
removeArrayin interfaceArrayHolder- Parameters:
name- Name of the array to return- Returns:
- The now-removed array
-
size
public int size()
- Specified by:
sizein interfaceArrayHolder- Returns:
- Number of arrays in the ArrayHolder
-
initFrom
public void initFrom(ArrayHolder arrayHolder)
Description copied from interface:ArrayHolderInitialize from the specified array holder. This clears all internal arrays, and adds all arrays from the specified array holder- Specified by:
initFromin interfaceArrayHolder- Parameters:
arrayHolder- Array holder to initialize this based on
-
arrayNames
public Collection<String> arrayNames()
- Specified by:
arrayNamesin interfaceArrayHolder- Returns:
- Names of the arrays currently in the ArrayHolder
-
rename
public void rename(String from, String to)
Description copied from interface:ArrayHolderRename the entry with the specified name- Specified by:
renamein interfaceArrayHolder- Parameters:
from- Original nameto- New name
-
-