From 03e2a0949688d68357fb2065960481a1ecb80909 Mon Sep 17 00:00:00 2001 From: Vijay Janapa Reddi Date: Sun, 20 Jul 2025 10:30:51 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Add=20missing=20test=20function?= =?UTF-8?q?=20calls=20and=20fix=20name=20mismatches=20in=2009=5Fautograd?= =?UTF-8?q?=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added test_unit_variable_class() call after function definition - Added test_unit_add_operation() call after function definition - Added test_unit_multiply_operation() call after function definition - Added test_unit_subtract_operation() call after function definition - Added test_unit_chain_rule() call after function definition - Added test_module_neural_network_training() call after function definition - Fixed function name mismatches in existing if __name__ == '__main__' calls Ensures all test functions are executed when cells run, providing immediate feedback to students. --- modules/source/09_autograd/autograd_dev.py | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/source/09_autograd/autograd_dev.py b/modules/source/09_autograd/autograd_dev.py index da5a0f0f..68269dff 100644 --- a/modules/source/09_autograd/autograd_dev.py +++ b/modules/source/09_autograd/autograd_dev.py @@ -350,9 +350,12 @@ def test_unit_variable_class(): print(f"✅ Data access and properties working") print(f"✅ Gradient management working") +# Run the test +test_unit_variable_class() + # Run inline tests when module is executed directly if __name__ == "__main__": - test_variable_class() + test_unit_variable_class() # %% [markdown] """ @@ -493,6 +496,9 @@ def test_unit_add_operation(): print(f"✅ Backward pass computing correct gradients") print(f"✅ Scalar addition working correctly") +# Run the test +test_unit_add_operation() + # Run inline tests when module is executed directly if __name__ == "__main__": test_add_operation() @@ -627,9 +633,12 @@ def test_unit_multiply_operation(): print(f"✅ Backward pass implementing product rule correctly") print(f"✅ Scalar multiplication working correctly") +# Run the test +test_unit_multiply_operation() + # Run inline tests when module is executed directly if __name__ == "__main__": - test_multiply_operation() + test_unit_multiply_operation() # %% nbgrader={"grade": false, "grade_id": "subtract-operation", "locked": false, "schema_version": 3, "solution": true, "task": false} #| export @@ -725,9 +734,12 @@ def test_unit_subtract_operation(): print(f"✅ Backward pass implementing subtraction rule correctly") print(f"✅ Scalar subtraction working correctly") +# Run the test +test_unit_subtract_operation() + # Run inline tests when module is executed directly if __name__ == "__main__": - test_subtract_operation() + test_unit_subtract_operation() # %% [markdown] """ @@ -810,9 +822,12 @@ def test_unit_chain_rule(): print(f"✅ Automatic gradient computation working correctly") print(f"✅ Chain rule implemented correctly") +# Run the test +test_unit_chain_rule() + # Run inline tests when module is executed directly if __name__ == "__main__": - test_chain_rule() + test_unit_chain_rule() # %% [markdown] """ @@ -926,6 +941,9 @@ def test_module_neural_network_training(): print(f"✅ Autograd enables automatic training") print(f"✅ Ready for complex neural network architectures!") +# Run the test +test_module_neural_network_training() + # %% [markdown] """ ## 🧪 Module Testing