code: def test_legacy_flow_with_input_shape(self):
      model = Sequential(name="seq")
      model.add(layers.Dense(4, input_shape=(2,)))
      model.add(layers.Dense(5))
  
      self.assertEqual(len(model.layers), 2)
      self.assertTrue(model.built)
      self.assertEqual(len(model.weights), 4)
      self.assertEqual(type(model._functional), Functional)
  
      # Input_dim works too
      model = Sequential(name="seq")
      model.add(layers.Dense(4, input_dim=2))
      model.add(layers.Dense(5))
  
      self.assertEqual(len(model.layers), 2)
      self.assertTrue(model.built)
      self.assertEqual(len(model.weights), 4)
      self.assertEqual(type(model._functional), Functional)
  
      # Subsequent input_shapes are ignored
      model = Sequential(name="seq")
      model.add(layers.Dense(4, input_shape=(2,)))
      model.add(layers.Dense(5, input_shape=(3, 4)))
  
      self.assertEqual(len(model.layers), 2)
      self.assertTrue(model.built)
      self.assertEqual(len(model.weights), 4)
      self.assertEqual(type(model._functional), Functional)
  
imports: import numpy
  import pytest
  from keras import backend
  from keras import layers
  from keras import testing
  from keras.layers.core.input_layer import Input
  from keras.models.functional import Functional
  from keras.models.sequential import Sequential
label_desc: Use image node_id 2 for calling the SequentialTest obj's underlying member method code with example usage: obj.test_legacy_flow_with_input_shape() without return types