From 9edeb49395645842818d82041c39e457294313ce Mon Sep 17 00:00:00 2001 From: Afeef k k <30346093+45afeef@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:02:24 +0530 Subject: [PATCH] fix - using input.shape instead of input_shape for layers which is not available anymore --- learntools/deep_learning_intro/ex2.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/learntools/deep_learning_intro/ex2.py b/learntools/deep_learning_intro/ex2.py index edcd57f5c..9a8effc25 100644 --- a/learntools/deep_learning_intro/ex2.py +++ b/learntools/deep_learning_intro/ex2.py @@ -61,10 +61,7 @@ def check(self, model): assert (layer_classes == true_classes), \ ("Your model doesn't have the correct kinds of layers. You should have five layers with classes: Dense, Dense, Dense, Dense.") # Check input shape - try: - input_shape = dense_layer.input_shape - except: - input_shape = None + input_shape = dense_layer.input.shape assert (input_shape == (None, inputs)), \ ("Your model should have {} inputs. Make sure you answered the previous question correctly!".format(inputs)) # Check activation functions @@ -111,10 +108,7 @@ def check(self, model): assert (layer_classes == true_classes), \ ("Your model doesn't have the correct kinds of layers. You should have five layers with classes: Dense, Activation, Dense, Activation, Dense.") - try: - input_shape = model.layers[0].input_shape - except: - input_shape = None + input_shape = model.layers[0].input.shape assert (input_shape == (None, 8)), \ ("Your model should have 8 inputs. Did you include the input shape to the first layer?") dense_activations = [layer.activation.__name__ for layer in model.layers]