tensorflow slim层和tensorflow手动构建层之间有区别吗?

2024-05-05 02:47:11 发布

您现在位置:Python中文网/ 问答频道 /正文

tensorflow薄层和人工构建层有什么区别吗? 例如,以下代码不同?在

  1. 张量流纤细

    output = slim.fully_connected(model_input, 1024, 
    activation_fn=tf.nn.relu,weights_regularizer=None,
    weights_initializer=tf.contrib.layers.xavier_initializer())
    
  2. 手动构建层

    W1 = tf.get_variable(name='W1', shape=[1024, 1024], initializer=tf.contrib.layers.xavier_initializer())
    b1 = tf.Variable(tf.random_normal([1024]))
    output = tf.nn.relu(tf.matmul(model_input, W1) + b1)
    

我以为这两个人完全一样,但在训练中,他们表现出了不同的表现。。在


Tags: inputoutputmodellayerstftensorflownncontrib