Why this sequential model is not starting?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am using following code:



input_shape = (75, 75, 3)
x = Input(input_shape)
model = BatchNormalization(axis = 3)(x)


Above code works all right. However, following code does not work:



input_shape = (64,64,3)
model = Sequential()
model = model.add(InputLayer(input_shape=input_shape))
model = model.add(BatchNormalization(axis = 3))


But at last line, I get error:



AttributeError: 'NoneType' object has no attribute 'add'


If I change to:



model = model.add(Input(input_shape))


I get following error:



TypeError: The added layer must be an instance of class Layer. 
Found: Tensor("input_1:0", shape=(?, 64, 64, 3), dtype=float32)


Where is the problem and how can it be solved?










share|improve this question

























    up vote
    1
    down vote

    favorite












    I am using following code:



    input_shape = (75, 75, 3)
    x = Input(input_shape)
    model = BatchNormalization(axis = 3)(x)


    Above code works all right. However, following code does not work:



    input_shape = (64,64,3)
    model = Sequential()
    model = model.add(InputLayer(input_shape=input_shape))
    model = model.add(BatchNormalization(axis = 3))


    But at last line, I get error:



    AttributeError: 'NoneType' object has no attribute 'add'


    If I change to:



    model = model.add(Input(input_shape))


    I get following error:



    TypeError: The added layer must be an instance of class Layer. 
    Found: Tensor("input_1:0", shape=(?, 64, 64, 3), dtype=float32)


    Where is the problem and how can it be solved?










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am using following code:



      input_shape = (75, 75, 3)
      x = Input(input_shape)
      model = BatchNormalization(axis = 3)(x)


      Above code works all right. However, following code does not work:



      input_shape = (64,64,3)
      model = Sequential()
      model = model.add(InputLayer(input_shape=input_shape))
      model = model.add(BatchNormalization(axis = 3))


      But at last line, I get error:



      AttributeError: 'NoneType' object has no attribute 'add'


      If I change to:



      model = model.add(Input(input_shape))


      I get following error:



      TypeError: The added layer must be an instance of class Layer. 
      Found: Tensor("input_1:0", shape=(?, 64, 64, 3), dtype=float32)


      Where is the problem and how can it be solved?










      share|improve this question













      I am using following code:



      input_shape = (75, 75, 3)
      x = Input(input_shape)
      model = BatchNormalization(axis = 3)(x)


      Above code works all right. However, following code does not work:



      input_shape = (64,64,3)
      model = Sequential()
      model = model.add(InputLayer(input_shape=input_shape))
      model = model.add(BatchNormalization(axis = 3))


      But at last line, I get error:



      AttributeError: 'NoneType' object has no attribute 'add'


      If I change to:



      model = model.add(Input(input_shape))


      I get following error:



      TypeError: The added layer must be an instance of class Layer. 
      Found: Tensor("input_1:0", shape=(?, 64, 64, 3), dtype=float32)


      Where is the problem and how can it be solved?







      neural-network keras






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      rnso

      2658




      2658




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote













          model = models.Sequential()
          model.add(InputLayer(input_shape=input_shape))
          model.add(BatchNormalization(axis = 3))


          Assuming you did not instantiate models class of Keras.






          share|improve this answer






















            Your Answer




            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "557"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f38921%2fwhy-this-sequential-model-is-not-starting%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            4
            down vote













            model = models.Sequential()
            model.add(InputLayer(input_shape=input_shape))
            model.add(BatchNormalization(axis = 3))


            Assuming you did not instantiate models class of Keras.






            share|improve this answer


























              up vote
              4
              down vote













              model = models.Sequential()
              model.add(InputLayer(input_shape=input_shape))
              model.add(BatchNormalization(axis = 3))


              Assuming you did not instantiate models class of Keras.






              share|improve this answer
























                up vote
                4
                down vote










                up vote
                4
                down vote









                model = models.Sequential()
                model.add(InputLayer(input_shape=input_shape))
                model.add(BatchNormalization(axis = 3))


                Assuming you did not instantiate models class of Keras.






                share|improve this answer














                model = models.Sequential()
                model.add(InputLayer(input_shape=input_shape))
                model.add(BatchNormalization(axis = 3))


                Assuming you did not instantiate models class of Keras.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 3 hours ago

























                answered 3 hours ago









                Danny

                1416




                1416



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f38921%2fwhy-this-sequential-model-is-not-starting%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    Long meetings (6-7 hours a day): Being “babysat” by supervisor

                    Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                    Confectionery