public class TFGraphMapper extends Object
| Constructor and Description |
|---|
TFGraphMapper() |
| Modifier and Type | Method and Description |
|---|---|
static DataType |
convertType(DataType tfType)
Convert from TF proto datatype to ND4J datatype
|
static INDArray |
getArrayFrom(NodeDef nodeDef,
GraphDef graph)
Deprecated.
|
static TFGraphMapper |
getInstance()
Deprecated.
Use static methods -
importGraph(File) etc |
static INDArray |
getNDArrayFromTensor(NodeDef node)
Convert the tensor to an NDArray (if possible and if array is available)
|
static String |
getNodeName(String name)
Deprecated.
To be removed
|
static NodeDef |
getNodeWithNameFromGraph(GraphDef graph,
String name)
Deprecated.
|
static SameDiff |
importGraph(@NonNull File f)
Import a frozen TensorFlow protobuf (.pb) file from the specified file
|
static SameDiff |
importGraph(@NonNull File f,
Map<String,TFImportOverride> importOverride,
TFOpImportFilter opFilter)
Import a frozen TensorFlow protobuf (.pb) file from the specified file, with optional overrides
|
static SameDiff |
importGraph(@NonNull GraphDef tfGraph)
Import a TensorFlow model from a GraphDef
|
static SameDiff |
importGraph(@NonNull GraphDef tfGraph,
Map<String,TFImportOverride> importOverride,
TFOpImportFilter opFilter)
Import a TensorFlow model from a GraphDef, with optional import overrides
|
static SameDiff |
importGraph(@NonNull InputStream is)
Import a frozen TensorFlow protobuf (.pb) file, via an input stream
|
static SameDiff |
importGraph(@NonNull InputStream is,
Map<String,TFImportOverride> importOverride,
TFOpImportFilter opFilter)
Import a frozen TensorFlow protobuf (.pb) file via an input stream, with optional overrides
|
static SameDiff |
importGraphTxt(@NonNull InputStream is,
Map<String,TFImportOverride> importOverride,
TFOpImportFilter opFilter)
Import a frozen TensorFlow protobuf file in text format (.pb.txt) file via an input stream, with optional overrides
|
static void |
initFunctionFromProperties(String mappedTfName,
DifferentialFunction on,
Map<String,AttrValue> attributesForNode,
NodeDef node,
GraphDef graph)
Deprecated.
To be removed
|
protected static boolean |
isControlDep(String name) |
static boolean |
isPlaceHolder(NodeDef nodeDef)
Determine if the node is a placeholder
|
static boolean |
isVariableNode(NodeDef nodeDef)
Determine if the node represents a variable node (based on op name)
|
static INDArray |
mapTensorProto(TensorProto tfTensor)
Convert a TensorProto to an INDArray
|
protected static String |
stripControl(String name) |
protected static String |
stripVarSuffix(String varName)
Remove the ":1" etc suffix for a variable name to get the op name
|
@Deprecated public static TFGraphMapper getInstance()
importGraph(File) etcpublic static SameDiff importGraph(@NonNull @NonNull File f)
f - Frozen TensorFlow model pb file to importpublic static SameDiff importGraph(@NonNull @NonNull File f, Map<String,TFImportOverride> importOverride, TFOpImportFilter opFilter)
f - Frozen TensorFlow model pb file to importimportOverride - Optional import override for specific ops, keyed by op nameopFilter - Optional filter - ops to exclude/ignorepublic static SameDiff importGraph(@NonNull @NonNull InputStream is)
is - Stream for a frozen TensorFlow model pb file to importpublic static SameDiff importGraphTxt(@NonNull @NonNull InputStream is, Map<String,TFImportOverride> importOverride, TFOpImportFilter opFilter)
is - Stream for a frozen TensorFlow model pb file to importimportOverride - Optional import override for specific ops, keyed by op nameopFilter - Optional filter - ops to exclude/ignorepublic static SameDiff importGraph(@NonNull @NonNull InputStream is, Map<String,TFImportOverride> importOverride, TFOpImportFilter opFilter)
is - Stream for a frozen TensorFlow model pb file to importimportOverride - Optional import override for specific ops, keyed by op nameopFilter - Optional filter - ops to exclude/ignorepublic static SameDiff importGraph(@NonNull @NonNull GraphDef tfGraph)
tfGraph - TensorFlow model GraphDefpublic static SameDiff importGraph(@NonNull @NonNull GraphDef tfGraph, Map<String,TFImportOverride> importOverride, TFOpImportFilter opFilter)
tfGraph - TensorFlow model GraphDefimportOverride - Optional import override for specific ops, keyed by op nameopFilter - Optional filter - ops to exclude/ignorepublic static DataType convertType(DataType tfType)
tfType - TF datatypeprotected static boolean isControlDep(String name)
protected static String stripControl(String name)
protected static String stripVarSuffix(String varName)
varName - Variable namepublic static INDArray getNDArrayFromTensor(NodeDef node)
node - Node to get NDArray frompublic static INDArray mapTensorProto(TensorProto tfTensor)
tfTensor - Tensor proto@Deprecated public static NodeDef getNodeWithNameFromGraph(GraphDef graph, String name)
@Deprecated public static INDArray getArrayFrom(NodeDef nodeDef, GraphDef graph)
@Deprecated public static void initFunctionFromProperties(String mappedTfName, DifferentialFunction on, Map<String,AttrValue> attributesForNode, NodeDef node, GraphDef graph)
mappedTfName - the tensorflow name to pick (sometimes ops have multiple nameson - the function to mapattributesForNode - the attributes for the nodenode - graph - @Deprecated public static String getNodeName(String name)
name - the name to changepublic static boolean isVariableNode(NodeDef nodeDef)
nodeDef - Node to check if a variablepublic static boolean isPlaceHolder(NodeDef nodeDef)
nodeDef - Node to checkCopyright © 2021. All rights reserved.