Java Code Examples for org.nd4j.imports.graphmapper.tf.TFGraphMapper#getArrayFrom()

The following examples show how to use org.nd4j.imports.graphmapper.tf.TFGraphMapper#getArrayFrom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SplitV.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) {
    val splitDim = TFGraphMapper.getArrayFrom(TFGraphMapper.getNodeWithNameFromGraph(graph,nodeDef.getInput(0)),graph);
    if(splitDim != null) {
        this.splitDim = splitDim.getInt(0);
        addIArgument(splitDim.getInt(0));
    }

    val numSplits = (int) attributesForNode.get("num_split").getI();
    this.numSplit = numSplits;
    //addIArgument(numSplits);  //libnd4j op doesn't used/need it for execution
}
 
Example 2
Source File: Split.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) {
    val numSplits = (int) attributesForNode.get("num_split").getI();
    this.numSplit = numSplits;
    addIArgument(numSplits);

    val splitDim = TFGraphMapper.getArrayFrom(TFGraphMapper.getNodeWithNameFromGraph(graph,nodeDef.getInput(0)),graph);
    if(splitDim != null) {
        this.splitDim = splitDim.getInt(0);
        addIArgument(splitDim.getInt(0));
    }
}
 
Example 3
Source File: BaseTensorOp.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) {
    val inputOne = nodeDef.getInput(1);
    val varFor = initWith.getVariable(inputOne);
    val nodeWithIndex = TFGraphMapper.getNodeWithNameFromGraph(graph,inputOne);
    val var = TFGraphMapper.getArrayFrom(nodeWithIndex,graph);
    if(var != null) {
        val idx = var.getInt(0);
        addIArgument(idx);
    }
}