tensorflow加载模型后获取模型中的张量名

进行迁移学习时,加载完别人的模型,想要进行一些微调,就需要想办法获取到该网络中某些张良的名称,尤其是输入和输出。

with tf.Session() as sess:

  #此处加载模型

  tensor_name_list = [tensor.name for tensor in tf.get_default_graph().as_graph_def().node]

  for tensor_name in tensor_name_list:

    print(tensor_name,'\n')

猜你喜欢

转载自www.cnblogs.com/biandekeren-blog/p/11887132.html