@Override public Message.Builder getNewGraphBuilder() { return GraphDef.newBuilder(); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
/** * <pre> * Definition of remote graph * </pre> * * <code>.tensorflow.GraphDef remote_graph = 1;</code> */ public Builder mergeRemoteGraph(org.tensorflow.framework.GraphDef value) { if (remoteGraphBuilder_ == null) { if (remoteGraph_ != null) { remoteGraph_ = org.tensorflow.framework.GraphDef.newBuilder(remoteGraph_).mergeFrom(value).buildPartial(); } else { remoteGraph_ = value; } onChanged(); } else { remoteGraphBuilder_.mergeFrom(value); } return this; } /**
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { //cond is only part of while loops if(nodeDef.getName().contains("/cond/")) return; //usually should be a merge node for a conditional val ifNodes = TFGraphMapper.getInstance().nodesForIf(nodeDef,graph); val trueScopeGraphDefBuilder = GraphDef.newBuilder(); for(val node : ifNodes.getTrueNodes()) { trueScopeGraphDefBuilder.addNode(node); } val trueScope = TFGraphMapper.getInstance().importGraph(trueScopeGraphDefBuilder.build()); val falseScopeGraphDefBuilder = GraphDef.newBuilder(); for(val node : ifNodes.getFalseNodes()) { falseScopeGraphDefBuilder.addNode(node); } val falseScope = TFGraphMapper.getInstance().importGraph(falseScopeGraphDefBuilder.build()); val condScopeGraphDefBuilder = GraphDef.newBuilder(); for(val node : ifNodes.getCondNodes()) { condScopeGraphDefBuilder.addNode(node); } val condScope = TFGraphMapper.getInstance().importGraph(condScopeGraphDefBuilder.build()); initWith.putSubFunction(ifNodes.getTrueBodyScopeName(),trueScope); initWith.putSubFunction(ifNodes.getFalseBodyScopeName(),falseScope); initWith.putSubFunction(ifNodes.getConditionBodyScopeName(),condScope); this.loopBodyExecution = trueScope; this.falseBodyExecution = falseScope; this.predicateExecution = condScope; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
/** * <pre> * GraphDef. * </pre> * * <code>.tensorflow.GraphDef graph_def = 2;</code> */ public Builder mergeGraphDef(org.tensorflow.framework.GraphDef value) { if (graphDefBuilder_ == null) { if (graphDef_ != null) { graphDef_ = org.tensorflow.framework.GraphDef.newBuilder(graphDef_).mergeFrom(value).buildPartial(); } else { graphDef_ = value; } onChanged(); } else { graphDefBuilder_.mergeFrom(value); } return this; } /**
/** * <pre> * Definition of remote graph * </pre> * * <code>.tensorflow.GraphDef remote_graph = 1;</code> */ public Builder mergeRemoteGraph(org.tensorflow.framework.GraphDef value) { if (remoteGraphBuilder_ == null) { if (remoteGraph_ != null) { remoteGraph_ = org.tensorflow.framework.GraphDef.newBuilder(remoteGraph_).mergeFrom(value).buildPartial(); } else { remoteGraph_ = value; } onChanged(); } else { remoteGraphBuilder_.mergeFrom(value); } return this; } /**