java张量流reset_default_graph [英] java tensorflow reset_default_graph
问题描述
我正在使用 tensorflow java API.
I am using the tensorflow java API.
在 Python 中,我可以通过以下方式重置默认图形:
In Python, I can reset the default graph via:
tf.reset_default_graph
tf.reset_default_graph
我在java api中找不到对应的函数.(我搜索了 Tensorflow.org 上的 JavaDoc + github 上的源代码.)
I can't find the corresponding function in the java api. (I've searched through the JavaDoc on Tensorflow.org + grepped through the source code on github.)
问题:有没有办法在java中重置默认图形?
Question: is there a way to reset the default graph in java?
推荐答案
Java 中没有默认图"的概念.Graph
对象明确提供给所有对图形进行操作的 API.例如,在 LabelImage.java
操作使用 Graph.opBuilder
.
There is no concept of a "default graph" in Java. The Graph
object is explicitly provided to all APIs that operate on graphs. For example, in LabelImage.java
operations are added to the graph using Graph.opBuilder
.
这与 Python 中存在隐式图不同,因此当您使用 tf.constant(1.)
时,Graph
不会提供给函数添加操作,它使用默认".
This is different from Python where there is an implicit graph, so when you use tf.constant(1.)
, the Graph
isn't provided to the function adding the operation, it uses the "default".
长话短说:没有 tf.reset_default_graph
等价物,因为没有默认"图的概念.
Long story short: There is no tf.reset_default_graph
equivalent as there is no notion of a "default" graph.
希望有所帮助.
这篇关于java张量流reset_default_graph的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!