2017-04-11 29 views
1

我試圖解決行使本網站 Convolutional Neural NetworksAttributeError的:模塊「tensorflow」有沒有屬性「batch_matrix_band_part」

的運動是:

The model architecture in inference() differs slightly from the CIFAR-10 model specified in cuda-convnet. In particular, the top layers of Alex's original model are locally connected and not fully connected. Try editing the architecture to exactly reproduce the locally connected architecture in the top layer.

我試圖在cifar10.py添加(batch_matrix_band_part)功能在inference()::的最後部分

with tf.variable_scope('softmax_linear') as scope: 
weights = _variable_with_weight_decay('weights', [192, NUM_CLASSES], 
             stddev=1/192.0, wd=0.0) 
biases = _variable_on_cpu('biases', [NUM_CLASSES], 
          tf.constant_initializer(0.0)) 
##softmax_linear = tf.add(tf.matmul(local4, weights), biases, name=scope.name) ## fully connection layer 

WeightTemp = tf.batch_matrix_band_part(weights, -1, 1, name=None) ##using band matrix to be locally connected 
                    ## tf.batch_matrix_band_part(input, num_lower, num_upper, name=None) 
softmax_linear= tf.add(tf.matmul(local4, weightTemp), biases, name-scope.name) 
tf.nn.softmax(softmax_linear, dim=-1, name=None) ## for normalize the logits 
_activation_summary(softmax_linear) 
return softmax_linear 

但這是給我這個錯誤r ::

AttributeError: module 'tensorflow' has no attribute 'batch_matrix_band_part' 

有什麼辦法可以解決這個問題嗎?

回答

1

正如錯誤所說 - 張量流不具有稱爲batch_matrix_band_part的方法。相反,使用tf.matrix_band_part

相關問題