TypeError: __init__() got multiple values for argument ‘strides’

I never worked with tensorflow, but according to the documentation of Conv2D it’s defined as

    filters, kernel_size, strides=(1, 1), padding='valid', data_format=None,
    dilation_rate=(1, 1), groups=1, activation=None, use_bias=True,
    kernel_initializer='glorot_uniform', bias_initializer='zeros',
    kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None,
    kernel_constraint=None, bias_constraint=None, **kwargs

As you can see strides is the third parameter.

Now you use Conv2D(24,5,5, strides = (2,2), input_shape= (66,200,3), activation='relu') where the third parameter is 5 and then you try to set strides again with the keyword parameter. It seems there is one parameter too much in your call.

Imagine the little Python gnome handling your code: “OK, the boss wants an instance of Conv2D. He sets the first argument filters to 4, the second argument kernel_size to 2 and the third argument stridesto 2. Done with the positional arguments. Now let’s continue with the keyword arguments. Here we have strides and … oh, I already have strides, so I don’t know what to do. The boss might be angry so I’ll tell him exactly what happenend: TypeError: __init__() got multiple values for argument 'strides'

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top