张量流中是否有无操作(直通)操作? [英] Is there an no-op (pass-through) operation in tensorflow?

查看:23
本文介绍了张量流中是否有无操作(直通)操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据标题.我想利用这样的操作来重命名节点并更好地组织图形.或者是否有其他推荐的做法来重命名图中的现有节点?谢谢!

As per title. I'd like to make use of such operation to rename the nodes and better organize a graph. Or is there other recommended practice for renaming an existing node in the graph? Thanks!

推荐答案

据我所知,张量一旦创建就不能重命名.

As far as I know, you cannot rename a Tensor once created.

但是,您可以使用额外的无操作"操作(如您所说):

However, you can use additional "no-op" operations (like you said):

  • 对于 tf.Tensor:tf.identity(input_tensor, name='your_new_name')

对于操作:tf.group(input_operation, name='your_new_name')

之后,你可以调用input_tensor:

graph = tf.get_default_graph()
graph.get_tensor_by_name('your_new_name:0')

或者 input_operation 带有:

graph = tf.get_default_graph()
graph.get_operation_by_name('your_new_name')

这篇关于张量流中是否有无操作(直通)操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆