我有一个复杂的网络,我为它创建了一个非常简单的类,用于在模型序列化为冻结图形文件后推断模型。
问题是在这个文件中我需要用他的命名空间加载变量,这可能最终取决于我如何构建模型。在我的情况下,结果如下:
# Load the input and output node with a singular namespace depending on the model
self.input_node = self.sess.graph.get_tensor_by_name("create_model/mymodelname/input_node:0")
self.output_node = self.sess.graph.get_tensor_by_name("create_model/mymodelname/out/output_node:0")
我想在将这两个节点存储到模型中之前给它一个别名,例如它们最终会有一个通用名称,然后我的推理类可以用作获取模型的通用类。在这种情况下,我最终会做这样的事情:
# Load the input and output node with a general node namespace
self.input_node = self.sess.graph.get_tensor_by_name("input_node:0")
self.output_node = self.sess.graph.get_tensor_by_name("output_node:0")
那么有没有办法给他们一个别名呢?我真的什么都没找到。
非常感谢!