Are these two model definitions differ from each other?

0

Issue

Do these two model definitions differ from each other or do they work the same way?

And if these are different, why?

def create_model(input):

   x = Conv2D(256, 3)(input)
   x = ReLU()(x)

   x = Flatten()(x)
   x = Dropout(0.4)(x)

   x = Dense(2, activation='sigmoid')(x)
   model = Model(input, x)
   return model


def create_model(input):
   model=Sequential([

       Conv2D(256, 3, input_shape=input_shape, activation='relu' ),
       Flatten(),
       Dropout(0.4),
       Dense(2, activation='sigmoid')


   ])
   return model

Solution

No, the model definitions are same. The only difference is the way you are defining i.e sequential and functional.

Answered By – keertika jain

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More