日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

input/output is not in graph tf.layers.conv2d在name命名时会自动在其后添加Conv2D

發布時間:2023/12/18 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 input/output is not in graph tf.layers.conv2d在name命名时会自动在其后添加Conv2D 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

tf.layers.conv2d()在用name命名時會自動在其后添加Conv2D
下面是編寫的一個dncnn網絡模型,分別給第一層block1和第17層block17命名為input和output

def dncnn(input, is_training=True, output_channels=1):with tf.variable_scope('block1'):output = tf.layers.conv2d(input, 64, 3, padding='same', activation=tf.nn.relu, name='input')for layers in range(2, 16 + 1):with tf.variable_scope('block%d' % layers):output = tf.layers.conv2d(output, 64, 3, padding='same', name='conv%d' % layers, use_bias=False)output = tf.nn.relu(tf.layers.batch_normalization(output, training=is_training))with tf.variable_scope('block17'):output = tf.layers.conv2d(output, output_channels, 3, padding='same', name='output')return input - output

在輸出pb模型時,導出輸入輸出節點時需要在其后加上/Conv2D

from tensorflow.python.framework.graph_util import convert_variables_to_constants constant_graph = convert_variables_to_constants(self.sess, self.sess.graph_def,["block1/input/Conv2D", "block17/output/Conv2D"])

總結

以上是生活随笔為你收集整理的input/output is not in graph tf.layers.conv2d在name命名时会自动在其后添加Conv2D的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。