alexnet_cifar10_multi_gpu1.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:dlbench 作者: hclhkbu 项目源码 文件源码
def _conv(inpOp, nIn, nOut, kH, kW, dH, dW, padType):
    global conv_counter
    global parameters
    name = 'conv' + str(conv_counter)
    conv_counter += 1
    with tf.variable_scope(name) as scope:
        #kernel = tf.get_variable(name='weights', initializer=tf.random_normal([kH, kW, nIn, nOut], dtype=tf.float32, stddev=1e-2))
        kernel = tf.get_variable(name='weights', shape=[kH, kW, nIn, nOut], initializer=tf.truncated_normal_initializer(dtype=tf.float32, stddev=1e-2))
        strides = [1, dH, dW, 1]
        conv = tf.nn.conv2d(inpOp, kernel, strides, padding=padType)
        #biases = tf.Variable(tf.constant(0.0, shape=[nOut], dtype=tf.float32),
        #                     trainable=True, name='biases')
        biases = tf.get_variable(name='biases', initializer=tf.constant(0.0, shape=[nOut], dtype=tf.float32), dtype=tf.float32)
        bias = tf.reshape(tf.nn.bias_add(conv, biases),
                          conv.get_shape())
        parameters += [kernel, biases]
        return bias
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号