Keras Error when returning model [on hold]












0












$begingroup$


I have defined the following function:



    def build(self):
input_layer = Input(shape=(self.col_amt,))
encoded = Dense(math.ceil(self.col_amt/2), activation='relu')(input_layer)
decoded = Dense(self.col_amt, activation='sigmoid')(encoded)
model = Model(input_layer, decoded)
model.compile(optimizer='adadelta', loss='binary_crossentropy')
return model


It's an encoder-decoder model using keras API.
self.col_amt is the number of features used.
While debugging, I get an error while i try to return the model (so on the last line).



The error is:



TypeError: __call__() missing 1 required positional argument: 'inputs'


Now here is the tricky/weird part. This exact function (i copy-pasted this code for testing purposes) is used in two child classes. When making one of the child class that contains the build() function i get the error. In the other one it runs fine. The function build() only depends on self.col_amt which is the same for the two child classes.



to conclude:




  • Super class has self.col_amt and this is filled in

  • Super class calls self.build() in the constructor

  • When making a child class the error occurs in the last line
    of build(). 'return model'


I've been stuck on this error for quite some time as I can't seem to wrap my head around it. Any direction is helpfull.










share|improve this question







New contributor




user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as unclear what you're asking by Thomas Cleberg, Sean Owen 3 hours ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.




















    0












    $begingroup$


    I have defined the following function:



        def build(self):
    input_layer = Input(shape=(self.col_amt,))
    encoded = Dense(math.ceil(self.col_amt/2), activation='relu')(input_layer)
    decoded = Dense(self.col_amt, activation='sigmoid')(encoded)
    model = Model(input_layer, decoded)
    model.compile(optimizer='adadelta', loss='binary_crossentropy')
    return model


    It's an encoder-decoder model using keras API.
    self.col_amt is the number of features used.
    While debugging, I get an error while i try to return the model (so on the last line).



    The error is:



    TypeError: __call__() missing 1 required positional argument: 'inputs'


    Now here is the tricky/weird part. This exact function (i copy-pasted this code for testing purposes) is used in two child classes. When making one of the child class that contains the build() function i get the error. In the other one it runs fine. The function build() only depends on self.col_amt which is the same for the two child classes.



    to conclude:




    • Super class has self.col_amt and this is filled in

    • Super class calls self.build() in the constructor

    • When making a child class the error occurs in the last line
      of build(). 'return model'


    I've been stuck on this error for quite some time as I can't seem to wrap my head around it. Any direction is helpfull.










    share|improve this question







    New contributor




    user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$



    put on hold as unclear what you're asking by Thomas Cleberg, Sean Owen 3 hours ago


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















      0












      0








      0





      $begingroup$


      I have defined the following function:



          def build(self):
      input_layer = Input(shape=(self.col_amt,))
      encoded = Dense(math.ceil(self.col_amt/2), activation='relu')(input_layer)
      decoded = Dense(self.col_amt, activation='sigmoid')(encoded)
      model = Model(input_layer, decoded)
      model.compile(optimizer='adadelta', loss='binary_crossentropy')
      return model


      It's an encoder-decoder model using keras API.
      self.col_amt is the number of features used.
      While debugging, I get an error while i try to return the model (so on the last line).



      The error is:



      TypeError: __call__() missing 1 required positional argument: 'inputs'


      Now here is the tricky/weird part. This exact function (i copy-pasted this code for testing purposes) is used in two child classes. When making one of the child class that contains the build() function i get the error. In the other one it runs fine. The function build() only depends on self.col_amt which is the same for the two child classes.



      to conclude:




      • Super class has self.col_amt and this is filled in

      • Super class calls self.build() in the constructor

      • When making a child class the error occurs in the last line
        of build(). 'return model'


      I've been stuck on this error for quite some time as I can't seem to wrap my head around it. Any direction is helpfull.










      share|improve this question







      New contributor




      user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      I have defined the following function:



          def build(self):
      input_layer = Input(shape=(self.col_amt,))
      encoded = Dense(math.ceil(self.col_amt/2), activation='relu')(input_layer)
      decoded = Dense(self.col_amt, activation='sigmoid')(encoded)
      model = Model(input_layer, decoded)
      model.compile(optimizer='adadelta', loss='binary_crossentropy')
      return model


      It's an encoder-decoder model using keras API.
      self.col_amt is the number of features used.
      While debugging, I get an error while i try to return the model (so on the last line).



      The error is:



      TypeError: __call__() missing 1 required positional argument: 'inputs'


      Now here is the tricky/weird part. This exact function (i copy-pasted this code for testing purposes) is used in two child classes. When making one of the child class that contains the build() function i get the error. In the other one it runs fine. The function build() only depends on self.col_amt which is the same for the two child classes.



      to conclude:




      • Super class has self.col_amt and this is filled in

      • Super class calls self.build() in the constructor

      • When making a child class the error occurs in the last line
        of build(). 'return model'


      I've been stuck on this error for quite some time as I can't seem to wrap my head around it. Any direction is helpfull.







      neural-network keras autoencoder






      share|improve this question







      New contributor




      user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 15 hours ago









      user66096user66096

      1




      1




      New contributor




      user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user66096 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      put on hold as unclear what you're asking by Thomas Cleberg, Sean Owen 3 hours ago


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






      put on hold as unclear what you're asking by Thomas Cleberg, Sean Owen 3 hours ago


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
























          0






          active

          oldest

          votes

















          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes

          Popular posts from this blog

          How to label and detect the document text images

          Tabula Rosettana

          Aureus (color)