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 aSameDiff
graph for execution.- Author:
- Adam Gibson
-
-
Field Summary
Fields Modifier and Type Field Description protected long
id
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SDValue
create(Collection<INDArray> inputValue)
Wrap anINDArray
in a value with anSDValueType.LIST
typestatic SDValue
create(List<INDArray> inputValue)
Wrap anINDArray
in a value with anSDValueType.LIST
typestatic SDValue
create(Map<String,INDArray> inputValue)
Wrap an {@link Map} in a value with an SDValueType.DICT
typestatic SDValue
create(INDArray inputValue)
Wrap anINDArray
in a tensor with anSDValueType.TENSOR
typestatic SDValue
empty(SDValueType valueType, DataType dataType)
Create an empty value for the givenDataType
boolean
equals(Object o)
Collection<INDArray>
getCollection()
long
getId()
List<INDArray>
getListValue()
Return anINDArray
if the value type isSDValueType.TENSOR
else return the list typeINDArray
getTensorValue()
Return anINDArray
if the value type isSDValueType.LIST
and the number of elements is 1 otherwise return thetensorValue
int
hashCode()
String
toString()
-
-
-
Method Detail
-
getId
public long getId()
- Specified by:
getId
in interfaceIDependeeGroup<INDArray>
-
getCollection
public Collection<INDArray> getCollection()
- Specified by:
getCollection
in interfaceIDependeeGroup<INDArray>
-
empty
public static SDValue empty(SDValueType valueType, DataType dataType)
Create an empty value for the givenDataType
- Parameters:
valueType
- the value type to createSDValue
fordataType
- the data type of the empty value- Returns:
- an empty (
Nd4j.empty(DataType)
forSDValueType.TENSOR
or an empty list or map for the other associated types
-
getTensorValue
public INDArray getTensorValue()
Return anINDArray
if the value type isSDValueType.LIST
and the number of elements is 1 otherwise return thetensorValue
- Returns:
-
getListValue
public List<INDArray> getListValue()
Return anINDArray
if the value type isSDValueType.TENSOR
else return the list type- Returns:
-
create
public static SDValue create(INDArray inputValue)
Wrap anINDArray
in a tensor with anSDValueType.TENSOR
type- Parameters:
inputValue
- the input value for theSDValue
- Returns:
- the created value
-
create
public static SDValue create(Collection<INDArray> inputValue)
Wrap anINDArray
in a value with anSDValueType.LIST
type- Parameters:
inputValue
- the input value- Returns:
- the created value
-
create
public static SDValue create(List<INDArray> inputValue)
Wrap anINDArray
in a value with anSDValueType.LIST
type- 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.DICT
type- Parameters:
inputValue
- the input value- Returns:
- the created value
-
-