Reputation: 577
I tried to solve the exercise in this website Convolutional Neural Networks
the exercise is:
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.
I tried to add (batch_matrix_band_part)
function in the cifar10.py
in last part of 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
but this is give me this error::
AttributeError: module 'tensorflow' has no attribute 'batch_matrix_band_part'
Is there any way to solve the problem?
Upvotes: 1
Views: 655
Reputation: 1052
It's exactly as the error is saying - tensorflow does not have a method called batch_matrix_band_part
. Instead, use tf.matrix_band_part
Upvotes: 1