From ba9c630e02088e3720fe8c8344d5882ea5076b17 Mon Sep 17 00:00:00 2001 From: MukundaKatta Date: Mon, 20 Apr 2026 18:43:27 -0700 Subject: [PATCH] fix(lab1 PT_Part1): print model_output instead of undefined y in Linear example The 'Neural networks in PyTorch' cell assigns 'model_output = model(x_input)' but the subsequent print statements referenced 'y', which is undefined in that cell (only defined earlier by OurDenseLayer). This raises NameError when the cell is run in isolation and prints the wrong tensor otherwise. Updated the two print statements to use 'model_output' in both PT_Part1_Intro.ipynb and the solutions copy. Closes #216 --- lab1/PT_Part1_Intro.ipynb | 4 ++-- lab1/solutions/PT_Part1_Intro_Solution.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lab1/PT_Part1_Intro.ipynb b/lab1/PT_Part1_Intro.ipynb index 49bcdeee..89f45d8f 100644 --- a/lab1/PT_Part1_Intro.ipynb +++ b/lab1/PT_Part1_Intro.ipynb @@ -425,8 +425,8 @@ "x_input = torch.tensor([[1, 2.]])\n", "model_output = model(x_input)\n", "print(f\"input shape: {x_input.shape}\")\n", - "print(f\"output shape: {y.shape}\")\n", - "print(f\"output result: {y}\")" + "print(f\"output shape: {model_output.shape}\")\n", + "print(f\"output result: {model_output}\")" ] }, { diff --git a/lab1/solutions/PT_Part1_Intro_Solution.ipynb b/lab1/solutions/PT_Part1_Intro_Solution.ipynb index a8feddf7..9cfef3d4 100644 --- a/lab1/solutions/PT_Part1_Intro_Solution.ipynb +++ b/lab1/solutions/PT_Part1_Intro_Solution.ipynb @@ -511,8 +511,8 @@ "x_input = torch.tensor([[1, 2.]])\n", "model_output = model(x_input)\n", "print(f\"input shape: {x_input.shape}\")\n", - "print(f\"output shape: {y.shape}\")\n", - "print(f\"output result: {y}\")" + "print(f\"output shape: {model_output.shape}\")\n", + "print(f\"output result: {model_output}\")" ] }, {