Skip to content

feat(engine, nn): add tanh/exp/log/sigmoid ops, flexible activations, and unittest suite - #126

Open
miskatul-anwar wants to merge 5 commits into
karpathy:masterfrom
miskatul-anwar:feat/autograd-ops-and-nn-tests
Open

feat(engine, nn): add tanh/exp/log/sigmoid ops, flexible activations, and unittest suite#126
miskatul-anwar wants to merge 5 commits into
karpathy:masterfrom
miskatul-anwar:feat/autograd-ops-and-nn-tests

Conversation

@miskatul-anwar

Copy link
Copy Markdown

Summary

This PR expands the autograd capabilities of micrograd and introduces a complete, standalone unit test suite:

  • Autograd Engine (micrograd/engine.py): Added tanh(), exp(), log(), and sigmoid() methods to the Value class with analytical gradient backpropagation.
  • Neural Networks (micrograd/nn.py): Enhanced Neuron to support 'tanh', 'sigmoid', and linear activations alongside 'relu'.
  • Test Suite (test/test_engine.py, test/test_nn.py): Refactored tests to Python's standard library unittest framework with graceful fallbacks when PyTorch is not installed, and added a dedicated test suite covering Neuron, Layer, and MLP modules.

Testing & Verification

Ran the full test suite via python3 -m unittest discover -s test:

..........
----------------------------------------------------------------------
Ran 10 tests in 0.001s

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant