Class SDValue
- java.lang.Object
-
- org.nd4j.autodiff.samediff.config.SDValue
-
- All Implemented Interfaces:
IDependeeGroup<INDArray>
public class SDValue extends Object implements IDependeeGroup<INDArray>
An SDValue represents a value that can be passed in and returned from aSameDiffgraph for execution.- Author:
- Adam Gibson
-
-
Field Summary
Fields Modifier and Type Field Description protected longid
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SDValuecreate(Collection<INDArray> inputValue)Wrap anINDArrayin a value with anSDValueType.LISTtypestatic SDValuecreate(List<INDArray> inputValue)Wrap anINDArrayin a value with anSDValueType.LISTtypestatic SDValuecreate(Map<String,INDArray> inputValue)Wrap an {@link Map} in a value with an SDValueType.DICTtypestatic SDValuecreate(INDArray inputValue)Wrap anINDArrayin a tensor with anSDValueType.TENSORtypestatic SDValueempty(SDValueType valueType, DataType dataType)Create an empty value for the givenDataTypebooleanequals(Object o)Collection<INDArray>getCollection()longgetId()List<INDArray>getListValue()Return anINDArrayif the value type isSDValueType.TENSORelse return the list typeINDArraygetTensorValue()Return anINDArrayif the value type isSDValueType.LISTand the number of elements is 1 otherwise return thetensorValueinthashCode()StringtoString()
-
-
-
Method Detail
-
getId
public long getId()
- Specified by:
getIdin interfaceIDependeeGroup<INDArray>
-
getCollection
public Collection<INDArray> getCollection()
- Specified by:
getCollectionin interfaceIDependeeGroup<INDArray>
-
empty
public static SDValue empty(SDValueType valueType, DataType dataType)
Create an empty value for the givenDataType- Parameters:
valueType- the value type to createSDValuefordataType- the data type of the empty value- Returns:
- an empty (
Nd4j.empty(DataType)forSDValueType.TENSORor an empty list or map for the other associated types
-
getTensorValue
public INDArray getTensorValue()
Return anINDArrayif the value type isSDValueType.LISTand the number of elements is 1 otherwise return thetensorValue- Returns:
-
getListValue
public List<INDArray> getListValue()
Return anINDArrayif the value type isSDValueType.TENSORelse return the list type- Returns:
-
create
public static SDValue create(INDArray inputValue)
Wrap anINDArrayin a tensor with anSDValueType.TENSORtype- Parameters:
inputValue- the input value for theSDValue- Returns:
- the created value
-
create
public static SDValue create(Collection<INDArray> inputValue)
Wrap anINDArrayin a value with anSDValueType.LISTtype- Parameters:
inputValue- the input value- Returns:
- the created value
-
create
public static SDValue create(List<INDArray> inputValue)
Wrap anINDArrayin a value with anSDValueType.LISTtype- Parameters:
inputValue- the input value- Returns:
- the created value
-
create
public static SDValue create(Map<String,INDArray> inputValue)
Wrap an {@link Map} in a value with an SDValueType.DICTtype- Parameters:
inputValue- the input value- Returns:
- the created value
-
-