Search code examples
pythonkeraserror-handlingmax-pooling

MaxPooling2D - Positional Argument follows keyword argument


My code is the following:

def create_model(input_shape = (224, 224, 3)):
    input_img = Input(shape=input_shape)
    model = efnB0_model (input_img)
    model = MaxPooling2D(pool_size=(3, 3), strides=2, 2)(model)

    backbone = model

When I try to run the code I get:

  File "<ipython-input-76-677f39f95f0d>", line 5
    model = MaxPooling2D(pool_size=(3, 3), strides=2, 2)(model)
                                                     ^
SyntaxError: positional argument follows keyword argument

How should I amend my code?


Solution

  • (Note: just by looking at it, cannot test)

    strides=(2, 2)
    

    (You are setting: strides=2,
    and then passing another positional arg 2)