m0_37630129 2019-03-29 14:10
浏览 707
已结题

vgg16计算反向传播时,无法读取全连接层

fc3

    with tf.name_scope('fc3') as scope:
        fc3w = tf.Variable(tf.truncated_normal([4096, 1000],
                                                     dtype=tf.float32,
                                                     stddev=1e-1), name='weights')
        fc3b = tf.Variable(tf.constant(1.0, shape=[1000], dtype=tf.float32),
                             trainable=True, name='biases')
        self.fc3l = tf.nn.bias_add(tf.matmul(self.fc2, fc3w), fc3b)
        self.layers[scope[:-1]] = self.fc3l
        self.parameters += [fc3w, fc3b]

KeyError Traceback (most recent call last)
in
10
11 # 反向梯度计算
---> 12 signal = tf.multiply(vgg_load.layers['fc3'], one_hot)
13 loss = tf.reduce_mean(signal)
14 grads = tf.gradients(loss, conv_layer)[0]

KeyError: 'fc3'

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥15 latex怎么处理论文引理引用参考文献
    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?