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 int
asFlatNode(@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 DifferentialFunction
cloneViaSerialize(SameDiff sd, DifferentialFunction df)
static DifferentialFunction
cloneViaSerialize(SameDiff sd, DifferentialFunction df, Map<String,Integer> nameToIdxMap)
static DifferentialFunction
fromFlatNode(FlatNode fn)
static VariableType
fromVarType(byte varType)
static byte
getDataTypeAsByte(@NonNull DataType type)
This method converts enums for DataTypestatic DataType
getDataTypeFromByte(byte val)
This method converts enums for DataTypestatic byte
getFlatOpType(Op.Type type)
This method converts an Op.Type to it's corresponding byte valuestatic byte
getLossFunctionAsByte(@NonNull LossReduce lossReduce)
Convert theLossReduce
enum to its flatbuffers equivalent bytes.static LossReduce
getLossReduceFromByte(byte input)
Convert the input byte to the equivalentLossReduce
, will throw anIllegalArgumentException
if the value is not foundstatic long
getOpNum(String name, Op.Type type)
This method return operation ID for given op name/type pair.static byte
getOrderAsByte()
This method returns current byte order for this JVM as libnd4j enumstatic ByteOrder
getOrderFromByte(byte val)
This method just converts enumsstatic Op.Type
getTypeFromByte(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 byte
toVarType(VariableType variableType)
-
-
-
Method Detail
-
getLossReduceFromByte
public static LossReduce getLossReduceFromByte(byte input)
Convert the input byte to the equivalentLossReduce
, will throw anIllegalArgumentException
if the value is not found- Parameters:
input
- the special input- Returns:
- the equivalent
LossReduce
value if one is found
-
getLossFunctionAsByte
public static byte getLossFunctionAsByte(@NonNull @NonNull LossReduce lossReduce)
Convert theLossReduce
enum 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)
-
-