Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
预训练的tensorflow神经网络模型_Tensorflow_Neural Network_Deep Learning - Fatal编程技术网

预训练的tensorflow神经网络模型

预训练的tensorflow神经网络模型,tensorflow,neural-network,deep-learning,Tensorflow,Neural Network,Deep Learning,如何从预训练的张量流中提取权重?我是第一次使用tensorflow。假设您已经训练了一个模型或恢复了以前训练过的模型,您可以使用与图形对象关联的get\u tensor\u by\u name()方法获取任何张量 weights = graph.get_tensor_by_name("NameScope/name:0") 如果在图形中定义了权重,如下所示: with tf.name_scope("Variables"): initial = tf.random_normal(dtype

如何从预训练的张量流中提取权重?我是第一次使用tensorflow。

假设您已经训练了一个模型或恢复了以前训练过的模型,您可以使用与图形对象关联的
get\u tensor\u by\u name()
方法获取任何张量

weights = graph.get_tensor_by_name("NameScope/name:0")
如果在图形中定义了权重,如下所示:

with tf.name_scope("Variables"):
    initial = tf.random_normal(dtype=tf.float32, shape=shape)
    l1_weights = tf.Variable(initial, name="weights")
然后,可以在培训后使用

trained_weights = graph.get_tensor_by_name("Variables/weights:0")
可以找到有关保存和恢复经过培训的模型的信息

可以找到有关
get\u tensor\u by\u name()
的详细信息