Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f6df88c
added the ctensor class and changes to cmake
K-T0BIAS Feb 7, 2025
64e574c
changed cpp version from 17 to 20 to use 'concepts'(cmake now works N…
K-T0BIAS Feb 7, 2025
8f43990
added new CTensor constructor use nested vectors as init arg. call li…
K-T0BIAS Feb 7, 2025
3154e64
created pybinds for Ctensor int and double also fixed some bugs and h…
K-T0BIAS Feb 11, 2025
a9781b1
fixed error in the setup.py file (sys wasnt included)
K-T0BIAS Feb 12, 2025
01db9bc
testing .md changes
K-T0BIAS Feb 13, 2025
a4e6763
testing .md changes
K-T0BIAS Feb 13, 2025
61ba244
layer documentation in the python part added
K-T0BIAS Feb 13, 2025
7a664fa
fixed bug where the CTensor would change after matmul backward. added…
K-T0BIAS Feb 13, 2025
e3f50b4
added minimal toml file for pip install
K-T0BIAS Feb 15, 2025
684249d
minor adjustments to gitignore
K-T0BIAS Feb 15, 2025
e90cba6
more tests for the py version
K-T0BIAS Feb 15, 2025
b2db021
minor changes
K-T0BIAS Feb 15, 2025
1880906
reconstructing the documentation into multiple specific .md files
K-T0BIAS Feb 15, 2025
f8bee99
reconstructing the documentation into multiple specific .md files
K-T0BIAS Feb 15, 2025
1604ce3
reconstructing the documentation into multiple specific .md files
K-T0BIAS Feb 15, 2025
80db8f7
reconstructing the documentation into multiple specific .md files
K-T0BIAS Feb 15, 2025
7a97c01
fixed bug where reshaping ops where not included in comp graph. Added…
K-T0BIAS Feb 20, 2025
c4e970b
new ci workflow .yml for the python lib tests
K-T0BIAS Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/py_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI - Python Tests

# Trigger the workflow on pushes and pull requests involving Python files
on:
workflow_dispatch:
push:
paths:
- 'src/**' # Monitor changes in src directory
- 'include/**' # Monitor changes in include directory
pull_request:
paths:
- 'src/**'
- 'include/**'

jobs:
python-tests:
runs-on: ubuntu-latest # Use the latest Ubuntu virtual environment

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Specify the Python version you need

- name: Install project and dependencies
run: |
python -m pip install --upgrade pip
pip install . # Install the project from the root directory

- name: Run Python unit tests
run: |
python -m unittest discover -s tests -p '*_test.py' # Discover and run all unittests in the 'tests' folder
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CTestTestfile.cmake
*.user
*.swp
*.tmp
*.egg-info

# IDE specific files (if you're using any IDE)
# Uncomment for Visual Studio Code
Expand Down
42 changes: 30 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,9 @@ cmake_minimum_required(VERSION 3.10)
project(SplineNetLib VERSION 1.0)

# Set the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

#include fetch content for catch2
include(FetchContent)

# fetch catch2 and make usable
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.4.0
)
FetchContent_MakeAvailable(Catch2)

# Optionally enable warnings for all compilers
if(MSVC)
add_compile_options(/W4)
Expand All @@ -35,12 +24,29 @@ add_library(SplineNetLib
src/splines.cpp
)

# Add the new template-based class headers and implementations
target_sources(SplineNetLib PRIVATE
src/CTensor.tpp
src/CTensorFunc.tpp
src/CTensorUtils.tpp
)

# Specify the include directories for the library target
target_include_directories(SplineNetLib PUBLIC ${PROJECT_SOURCE_DIR}/include)

option(ENABLE_TESTS "allow catch2 install and tests to run" OFF)

if(ENABLE_TESTS)
#include fetch content for catch2
include(FetchContent)

# fetch catch2 and make usable
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.4.0
)
FetchContent_MakeAvailable(Catch2)

#enable testing
enable_testing()
Expand All @@ -67,6 +73,12 @@ add_executable(SplineNetExample examples/example_network.cpp)
# Link the example with the library
target_link_libraries(SplineNetExample PRIVATE SplineNetLib)

# Add an example or test executable
add_executable(SplineNetExampleTensor examples/example_CTensor.cpp)

# Link the example with the library
target_link_libraries(SplineNetExampleTensor PRIVATE SplineNetLib)

# Optional: Install the library and headers
install(TARGETS SplineNetLib DESTINATION lib)
install(DIRECTORY include/SplineNetLib DESTINATION include)
Expand All @@ -85,3 +97,9 @@ write_basic_package_version_file(
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SplineNetLibConfigVersion.cmake" DESTINATION lib/cmake/SplineNetLib)








105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# About Spline-based-DeepLearning

## bugs

* reshaping a CTensor after performing operations on it may break the gradient calculation!

## Table of contents

[goals](#goals)

[C++ spline documentation](docs/cpp_splines.md)

[C++ CTensor documentation](docs/cpp_CTensor.md)

[python spline documentation](docs/py_splines.md)


## New:

* python version of the spline and layer classes

see [install for python](#install-for-python) to install

* batch compatibility for layers

* CTensor class (tensor class with automatic computation graph and gradient propagation)

* python version for CTensor

**documentation was not yet updated some features might have changed and new features were added**

**updates will follow soon**

## goals

1. create visual representations for neural networks by replacing commonly used fully connected layers with spline based layers.
2. achieve similar or better precision to common deep learning approaches whilst keeping the structure as light-wheight and fast as possible.
3. allow easy adaptability to existing architectures like convolutional and recurrent networks.

## install for c++

```txt
git clone https://github.com/K-T0BIAS/Spline-based-DeepLearning.git
cd Spline-based-DeepLearning
mkdir build
cd build
cmake ..
make
make install or make install DESTDIR=/path_to_desired_directory
```
to run the example : ./SplineNetExample

## include

in .cpp:
```cpp
#include "SplineNetLib/Network.hpp"
```

in the projects cmake:
```txt
cmake_minimum_required(VERSION 3.10)
project(YourProjectDirectory)

# Set C++ standard
set(CMAKE_CXX_STANDARD 17)

# Find SplineNetLib package
find_package(SplineNetLib REQUIRED)

# Add executable and link with SplineNetLib
add_executable(YourProjectDirectory main.cpp)
target_link_libraries(YourProjectDirectory PRIVATE SplineNetLib)
```

or in terminal:
```txt
g++ -std=c++17 -I/path_to_include -L/path_to_lib -lSplineNetLib main.cpp -o YourProjectDirectory
```
* Replace /path_to_include with the path to the installed include directory.

* Replace /path_to_lib with the path where libSplineNetLib.a is located.

## install for python

**Note this only includes splines and layer, no Network class**

**REQUIRED: pybind11, setuptools, wheel (if not already install these with pip)**

```txt
git clone https://github.com/K-T0BIAS/Spline-based-DeepLearning.git
cd Spline-based-DeepLearning
pip install .
```


## License

This project is licensed under the Mozilla Public License 2.0.

Copyright (c) 2024 Tobias Karusseit. See the [LICENSE](./LICENSE) file for details.

This project also uses `pybind11`, which is licensed under the MIT License. See [pybind11 GitHub](https://github.com/pybind/pybind11) for more details.

This project also uses `Catch2`, which is licensed under the Boost Software License 1.0. See [Catch2 GitHub](https://github.com/catchorg/Catch2) for more details.
Loading
Loading