tensorflowbook icon indicating copy to clipboard operation
tensorflowbook copied to clipboard

Chapter 5 code errors in cnn sample

Open JohnFarl opened this issue 9 years ago • 1 comments

I have already fixed some errors by myself however the way how parameters are passed in this method seems wrong and I get the error got an unexpected keyword argument

layer_one = tf.contrib.layers.convolution2d( float_image_batch, num_output_channels=32,
kernel_size=(5,5),
activation_fn=tf.nn.relu, weight_init=tf.random_normal, stride=(2, 2), trainable=True)

More details on my Stackoverflow question http://stackoverflow.com/questions/41539658/tensorflow-error-when-i-try-to-use-tf-contrib-layers-convolution2d/41540092#41540092

JohnFarl avatar Jan 09 '17 16:01 JohnFarl

      conv2d_layer_one = tf.contrib.layers.convolution2d(                
      float_image_batch,                  
      #num_output_channels=32,     # The number of filters to generate               
      num_outputs=32,           
      kernel_size=(5,5),                     # It's only the filter height and width.          
      activation_fn=tf.nn.relu,        
      #weight_init=tf.random_normal,         
      weights_initializer=tf.random_normal_initializer(),        
      stride=(2, 2),        
      trainable=True)       

my updated code seems OK.
The version of tf used in book is 0.8.0 as mentioned in requirements, my version is latest 0.12.0.

irwenqiang avatar Feb 02 '17 02:02 irwenqiang