Java Code Examples for org.nd4j.imports.graphmapper.tf.TFGraphMapper#convertType()
The following examples show how to use
org.nd4j.imports.graphmapper.tf.TFGraphMapper#convertType() .
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: TensorArray.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { val idd = nodeDef.getInput(nodeDef.getInputCount() - 1); NodeDef iddNode = null; for(int i = 0; i < graph.getNodeCount(); i++) { if(graph.getNode(i).getName().equals(idd)) { iddNode = graph.getNode(i); } } val arr = TFGraphMapper.getNDArrayFromTensor(iddNode); if (arr != null) { int idx = arr.getInt(0); addIArgument(idx); } this.tensorArrayDataType = TFGraphMapper.convertType(attributesForNode.get("dtype").getType()); }
Example 2
Source File: Create.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { // convert output data type if(attributesForNode.containsKey("dtype")) { outputType = TFGraphMapper.convertType(attributesForNode.get("dtype").getType()); } // get init field if(attributesForNode.containsKey("init")) { initialize = attributesForNode.get("init").getB(); } // there's no order in TF, just plain C this.order = 'c'; addArgs(); }
Example 3
Source File: OnesLike.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { if(attributesForNode.containsKey("T")) { outputType = TFGraphMapper.convertType(attributesForNode.get("T").getType()); } addArgs(); }
Example 4
Source File: Shape.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { super.initFromTensorFlow(nodeDef, initWith, attributesForNode, graph); dataType = TFGraphMapper.convertType(nodeDef.getAttrOrThrow("out_type").getType()); val dtype = DataTypeAdapter.dtypeConv(nodeDef.getAttrOrThrow("out_type").getType()); iArguments.add((long) FlatBuffersMapper.getDataTypeAsByte(dtype)); }
Example 5
Source File: OneHot.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { TFGraphMapper.initFunctionFromProperties(nodeDef.getOp(), this, attributesForNode, nodeDef, graph); addArgs(); if(attributesForNode.containsKey("T")) { outputType = TFGraphMapper.convertType(attributesForNode.get("T").getType()); } }
Example 6
Source File: Relu6.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { //TF cutoff is always 0.0. Need to make sure scalar type is same as input type (due to scalar op 'same type' exec restrictions) if(attributesForNode.containsKey("T")){ attributesForNode.get("T").getType(); DataType dt = TFGraphMapper.convertType(attributesForNode.get("T").getType()); scalarValue = Nd4j.scalar(dt, 0.0); } }
Example 7
Source File: DistributionUniform.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { AttrValue vDtype = attributesForNode.get("dtype"); AttrValue vTout = attributesForNode.get("Tout"); if (vDtype == null && vTout == null) { throw new ND4JIllegalStateException("Unable to find output data type for node " + nodeDef.getName()); } AttrValue v = vDtype == null ? vTout : vDtype; dataType = TFGraphMapper.convertType(v.getType()); addIArgument(dataType.toInt()); addTArgument(0.0, 1.0); //TF version is hardcoded 0 to 1 }
Example 8
Source File: ArgMin.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { if(attributesForNode.containsKey("output_type")) { outputType = TFGraphMapper.convertType(attributesForNode.get("output_type").getType()); } else { outputType = DataType.LONG; } }
Example 9
Source File: ArgAmax.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { if(attributesForNode.containsKey("output_type")) { outputType = TFGraphMapper.convertType(attributesForNode.get("output_type").getType()); } else { outputType = DataType.LONG; } }
Example 10
Source File: ArgMax.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { if(attributesForNode.containsKey("output_type")) { outputType = TFGraphMapper.convertType(attributesForNode.get("output_type").getType()); } else { outputType = DataType.LONG; } }
Example 11
Source File: ArgAmin.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { if(attributesForNode.containsKey("output_type")) { outputType = TFGraphMapper.convertType(attributesForNode.get("output_type").getType()); } else { outputType = DataType.LONG; } }
Example 12
Source File: FusedBatchNorm.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { boolean isNchw = attributesForNode.containsKey("data_format") && attributesForNode.get("data_format").getS().toStringUtf8().equalsIgnoreCase("NCHW"); boolean training = !attributesForNode.containsKey("is_training") ? true : attributesForNode.get("is_training").getB(); addIArgument(isNchw ? 1 : 0); addIArgument(training ? 1 : 0); if(attributesForNode.containsKey("T")){ outputDataType = TFGraphMapper.convertType(attributesForNode.get("T").getType()); } }
Example 13
Source File: Lu.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { if (attributesForNode.containsKey("output_idx_type")){ indexDataType = TFGraphMapper.convertType(attributesForNode.get("output_idx_type").getType()); } }
Example 14
Source File: Linspace.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { dataType = TFGraphMapper.convertType(attributesForNode.get("T").getType()); }
Example 15
Source File: Size.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { dataType = TFGraphMapper.convertType(nodeDef.getAttrOrThrow("out_type").getType()); }
Example 16
Source File: Unique.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { idxDataType = TFGraphMapper.convertType(nodeDef.getAttrOrThrow("out_idx").getType()); }
Example 17
Source File: UniqueWithCounts.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { idxDataType = TFGraphMapper.convertType(nodeDef.getAttrOrThrow("out_idx").getType()); }
Example 18
Source File: ZerosLike.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { if(attributesForNode.containsKey("T")) { outputType = TFGraphMapper.convertType(attributesForNode.get("T").getType()); } }
Example 19
Source File: TensorArrayRead.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { super.initFromTensorFlow(nodeDef, initWith, attributesForNode, graph); this.importDataType = TFGraphMapper.convertType(attributesForNode.get("dtype").getType()); }
Example 20
Source File: BinCount.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { if(attributesForNode.containsKey("T")) { outputType = TFGraphMapper.convertType(attributesForNode.get("T").getType()); } }