-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
58 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
<div align="center"> | ||
|
||
<h1>Shkyera Tensor</h1> | ||
<h1>Shkyera Grad</h1> | ||
<i>micrograd, but in C++ and with more functionality.</i> | ||
|
||
</div> | ||
|
||
This is a small header-only library of a scalar-valued autograd based on [Andrej Karpathy's micrograd](https://github.com/karpathy/micrograd). It provides a high-level, PyTorch-like API for creating simple neural networks. | ||
|
||
## Usage | ||
|
||
Make sure your compiler supports C++17. Shkyera Grad is a header-only library, so the only thing you need to do is to include it in your project. | ||
|
||
```cpp | ||
#include "include/ShkyeraGrad.hpp" | ||
``` | ||
|
||
Check out the [examples](examples/README.md) for a quick start on Shkyera Grad. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## Shkyera Grad Examples | ||
|
||
To compile an example, simply run the following command: | ||
|
||
``` | ||
g++ --std=c++17 xor_nn.cpp | ||
``` | ||
|
||
Remember to replace the file name with the appropriate name :) | ||
|
||
## Scalars | ||
|
||
Provides a brief overview of operating on scalars. | ||
|
||
## XOR Neural Network | ||
|
||
Small neural network that learns the xor function. In particular, given a vector of two values, it predicts a single value according to the XOR function. The training runs with a learning rate of 0.1 for 100 epochs using MSE loss. | ||
|
||
After running this example, the output should look somewhat like this: | ||
|
||
``` | ||
Epoch: 1 Loss: 1.57581 | ||
Epoch: 2 Loss: 1.46817 | ||
(...) | ||
Epoch: 99 Loss: 0.0386917 | ||
Epoch: 100 Loss: 0.0371898 | ||
Vector(size=2, data={Value(data=0) Value(data=0) }) -> Value(data=0.115728)| True: Value(data=0) | ||
Vector(size=2, data={Value(data=1) Value(data=0) }) -> Value(data=0.93215) | True: Value(data=1) | ||
Vector(size=2, data={Value(data=0) Value(data=1) }) -> Value(data=0.937625)| True: Value(data=1) | ||
Vector(size=2, data={Value(data=0) Value(data=0) }) -> Value(data=0.115728)| True: Value(data=0) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.