Skip to content

Commit

Permalink
Small documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fszewczyk committed Nov 8, 2023
1 parent 043afd8 commit 4aec860
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 49 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/docs.yml

This file was deleted.

13 changes: 3 additions & 10 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ jobs:
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ include/ShkyeraTensor.hpp --std=c++20
g++ include/ShkyeraTensor.hpp --std=c++17
- name: Build examples
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ examples/algebra.cpp --std=c++20
g++ examples/dataset.cpp --std=c++20
- name: Test
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ tests/mainTest.cpp --std=c++20
./a.out
g++ examples/scalars.cpp --std=c++17
g++ examples/xor_nn.cpp --std=c++17
13 changes: 3 additions & 10 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ jobs:
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ include/ShkyeraTensor.hpp --std=c++20
g++ include/ShkyeraTensor.hpp --std=c++17
- name: Build examples
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ examples/algebra.cpp --std=c++20
g++ examples/dataset.cpp --std=c++20
- name: Test
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ tests/mainTest.cpp --std=c++20
./a.out
g++ examples/scalars.cpp --std=c++17
g++ examples/xor_nn.cpp --std=c++17
11 changes: 3 additions & 8 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ jobs:
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ include/ShkyeraTensor.hpp --std=c++20
g++ include/ShkyeraTensor.hpp --std=c++17
- name: Build examples
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ examples/algebra.cpp --std=c++20
g++ examples/dataset.cpp --std=c++20
- name: Test
env:
CXX: ${{matrix.conf.compiler}}
run: |
g++ tests/mainTest.cpp --std=c++20 -o out.exe
g++ examples/scalars.cpp --std=c++17
g++ examples/xor_nn.cpp --std=c++17
17 changes: 16 additions & 1 deletion README.md
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.
31 changes: 31 additions & 0 deletions examples/README.md
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)
```
2 changes: 1 addition & 1 deletion examples/scalars.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../include/ShkyeraTensor.hpp"
#include "../include/ShkyeraGrad.hpp"

int main() {
using namespace shkyera;
Expand Down
2 changes: 1 addition & 1 deletion examples/xor_nn.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../include/ShkyeraTensor.hpp"
#include "../include/ShkyeraGrad.hpp"

int main() {
using namespace shkyera;
Expand Down
File renamed without changes.

0 comments on commit 4aec860

Please sign in to comment.