Package org.nd4j.autodiff.samediff.serde
Class FlatBuffersMapper
- java.lang.Object
-
- org.nd4j.autodiff.samediff.serde.FlatBuffersMapper
-
public class FlatBuffersMapper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intasFlatNode(@NonNull SameDiff sameDiff, @NonNull DifferentialFunction node, @NonNull com.google.flatbuffers.FlatBufferBuilder bufferBuilder, List<SDVariable> variables, Map<String,Integer> reverseMap, Map<String,Integer> forwardMap, Map<String,Integer> framesMap, AtomicInteger idCounter, Integer id)static DifferentialFunctioncloneViaSerialize(SameDiff sd, DifferentialFunction df)static DifferentialFunctioncloneViaSerialize(SameDiff sd, DifferentialFunction df, Map<String,Integer> nameToIdxMap)static DifferentialFunctionfromFlatNode(FlatNode fn)static VariableTypefromVarType(byte varType)static bytegetDataTypeAsByte(@NonNull DataType type)This method converts enums for DataTypestatic DataTypegetDataTypeFromByte(byte val)This method converts enums for DataTypestatic bytegetFlatOpType(Op.Type type)This method converts an Op.Type to it's corresponding byte valuestatic bytegetLossFunctionAsByte(@NonNull LossReduce lossReduce)Convert theLossReduceenum to its flatbuffers equivalent bytes.static LossReducegetLossReduceFromByte(byte input)Convert the input byte to the equivalentLossReduce, will throw anIllegalArgumentExceptionif the value is not foundstatic longgetOpNum(String name, Op.Type type)This method return operation ID for given op name/type pair.static bytegetOrderAsByte()This method returns current byte order for this JVM as libnd4j enumstatic ByteOrdergetOrderFromByte(byte val)This method just converts enumsstatic Op.TypegetTypeFromByte(byte type)This method converts enums for Op.Typestatic Map<String,Object>mapFlatPropertiesToFunctionProperties(Iterable<FlatProperties> list)static int[]mapFunctionPropertiesToFlatProperties(com.google.flatbuffers.FlatBufferBuilder fbb, Map<String,Object> fnProps)static int[]mapOrNull(List<String> list, com.google.flatbuffers.FlatBufferBuilder fbb)static bytetoVarType(VariableType variableType)
-
-
-
Method Detail
-
getLossReduceFromByte
public static LossReduce getLossReduceFromByte(byte input)
Convert the input byte to the equivalentLossReduce, will throw anIllegalArgumentExceptionif the value is not found- Parameters:
input- the special input- Returns:
- the equivalent
LossReducevalue if one is found
-
getLossFunctionAsByte
public static byte getLossFunctionAsByte(@NonNull @NonNull LossReduce lossReduce)Convert theLossReduceenum to its flatbuffers equivalent bytes.- Parameters:
lossReduce- the loss reduce input- Returns:
-
getDataTypeAsByte
public static byte getDataTypeAsByte(@NonNull @NonNull DataType type)This method converts enums for DataType
-
getDataTypeFromByte
public static DataType getDataTypeFromByte(byte val)
This method converts enums for DataType
-
getOpNum
public static long getOpNum(String name, Op.Type type)
This method return operation ID for given op name/type pair.
-
getTypeFromByte
public static Op.Type getTypeFromByte(byte type)
This method converts enums for Op.Type- Parameters:
type- Byte representing the op type- Returns:
- Op type
-
getFlatOpType
public static byte getFlatOpType(Op.Type type)
This method converts an Op.Type to it's corresponding byte value- Parameters:
type- type to convert- Returns:
- Byte representing the op type
-
getOrderFromByte
public static ByteOrder getOrderFromByte(byte val)
This method just converts enums
-
getOrderAsByte
public static byte getOrderAsByte()
This method returns current byte order for this JVM as libnd4j enum
-
fromFlatNode
public static DifferentialFunction fromFlatNode(FlatNode fn)
-
mapFunctionPropertiesToFlatProperties
public static int[] mapFunctionPropertiesToFlatProperties(com.google.flatbuffers.FlatBufferBuilder fbb, Map<String,Object> fnProps)
-
mapFlatPropertiesToFunctionProperties
public static Map<String,Object> mapFlatPropertiesToFunctionProperties(Iterable<FlatProperties> list)
-
asFlatNode
public static int asFlatNode(@NonNull @NonNull SameDiff sameDiff, @NonNull @NonNull DifferentialFunction node, @NonNull @NonNull com.google.flatbuffers.FlatBufferBuilder bufferBuilder, List<SDVariable> variables, Map<String,Integer> reverseMap, Map<String,Integer> forwardMap, Map<String,Integer> framesMap, AtomicInteger idCounter, Integer id)
-
mapOrNull
public static int[] mapOrNull(List<String> list, com.google.flatbuffers.FlatBufferBuilder fbb)
-
cloneViaSerialize
public static DifferentialFunction cloneViaSerialize(SameDiff sd, DifferentialFunction df)
-
cloneViaSerialize
public static DifferentialFunction cloneViaSerialize(SameDiff sd, DifferentialFunction df, Map<String,Integer> nameToIdxMap)
-
toVarType
public static byte toVarType(VariableType variableType)
-
fromVarType
public static VariableType fromVarType(byte varType)
-
-