Tensor Flow - MetaGraphDef Protobuf:collection_def中node_list和bytes_list之间的区别

时间:2017-12-14 14:50:39

标签: python tensorflow protocol-buffers

我目前正在研究Tensor Flow,我需要更好地了解框架Python API如何在保存操作期间序列化tf.Variables。模型已在分布式计算期间保存(我不知道此信息是否有用)。 为了清楚地以这种方式创建一个tf.Variable:

import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;

//@RunWith(Cucumber.class)
@CucumberOptions(
        features = "src/main/java/features/loginnewtour.feature",
        glue={"stepDef"}, 
        plugin= {
            "pretty","html:test-outout", 
            "json:json_output/cucumber.json", 
            "junit:junit_xml/cucumber.xml"
        }, 
        monochrome = true,
        strict = true, 
        dryRun = false
)

public class TestRunner extends AbstractTestNGCucumberTests{

}

我在protobuf中得到了这种collection_def。

mvn compile test

如果我用这行代码创建一个tf.Variable:

Running myRunner.TestRunner
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@6bf2d08e
Feature: New Tour Login Testing

  Scenario: Valid data testing           # src/main/java/features/loginnewtour.feature:2
    Given user is already on Login Page  # loginstepdefnewtour.user_is_already_on_Login_Page()
    When title of login page is new tour # loginstepdefnewtour.title_of_login_page_is_new_tour()
    Then user enters "mercury"           # loginstepdefnewtour.user_enters_and(String)

1 Scenarios (1 passed)
3 Steps (3 passed)

我在我保存的模型的protobuf中得到了collection_def:

global_step = tf.get_variable(tf.GraphKeys.GLOBAL_STEP, shape=[], dtype=tf.int64, initializer=tf.zeros_initializer(), collections=[tf.GraphKeys.GLOBAL_VARIABLES, tf.GraphKeys.GLOBAL_STEP], use_resource=True)

为什么第一个collection_def有一个bytes_list而第二个有一个node_list?关于存储和恢复模型的这两种情况有哪些区别?

0 个答案:

没有答案