commit
681deb060c
16 changed files with 30 additions and 69 deletions
|
|
@ -9,7 +9,7 @@ NVCCFLAGS = -std=c++11
|
|||
# Directories
|
||||
SRCDIR = ../norch/csrc
|
||||
BUILDDIR = ../build
|
||||
TARGET = ../build/libtensor.so
|
||||
TARGET = ../norch/libtensor.so
|
||||
|
||||
# Files
|
||||
SRCS = $(wildcard $(SRCDIR)/*.cpp)
|
||||
|
|
|
|||
BIN
build/cpu.o
BIN
build/cpu.o
Binary file not shown.
BIN
build/cuda.cu.o
BIN
build/cuda.cu.o
Binary file not shown.
BIN
build/tensor.o
BIN
build/tensor.o
Binary file not shown.
|
|
@ -1,4 +0,0 @@
|
|||
apt install nvidia-cuda-toolkit
|
||||
cd build
|
||||
make
|
||||
cd ..
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
from norch.tensor import Tensor
|
||||
from .nn import *
|
||||
from .optim import *
|
||||
from .optim import *
|
||||
from .utils import *
|
||||
|
||||
__version__ = "0.0.1"
|
||||
__author__ = 'Lucas de Lima Nogueira'
|
||||
__credits__ = 'Lucas de Lima Nogueira'
|
||||
Binary file not shown.
Binary file not shown.
1
norch/autograd/__init__.py
Normal file
1
norch/autograd/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from .functions import *
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: norch
|
||||
Version: 0.0.1
|
||||
Summary: A deep learning framework
|
||||
Home-page: https://github.com/lucasdelimanogueira/PyNorch
|
||||
Author: Lucas de Lima
|
||||
Author-email: nogueiralucasdelima@gmail.com
|
||||
Project-URL: Bug Tracker, https://github.com/lucasdelimanogueira/PyNorch/issues
|
||||
Project-URL: Repository, https://github.com/lucasdelimanogueira/PyNorch
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Operating System :: OS Independent
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/markdown
|
||||
|
||||
# PyNorch
|
||||
Recreating PyTorch from scratch (C/C++, CUDA and Python, with GPU support and automatic differentiation!)
|
||||
|
||||
# 1 - About
|
||||
**PyNorch** is a deep learning framework constructed using C/C++, CUDA and Python. This is a personal project with educational purpose only! `Norch` means **NOT** PyTorch, and we have **NO** claims to rivaling the already established PyTorch. The main objective of **PyNorch** was to give a brief understanding of how a deep learning framework works internally. It implements the Tensor object, GPU support and an automatic differentiation system.
|
||||
|
||||
# 2 - Installation
|
||||
```css
|
||||
$ sudo apt install nvidia-cuda-toolkit
|
||||
$ git clone https://github.com/lucasdelimanogueira/PyNorch.git
|
||||
$ cd build
|
||||
$ make
|
||||
$ cd ..
|
||||
```
|
||||
|
||||
# 3 - Get started
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
README.md
|
||||
install.sh
|
||||
setup.py
|
||||
norch/nn/__init__.py
|
||||
norch/nn/activation.py
|
||||
norch/nn/loss.py
|
||||
norch/nn/module.py
|
||||
norch/nn/parameter.py
|
||||
norch/nn/modules/__init__.py
|
||||
norch/nn/modules/linear.py
|
||||
norch/norch.egg-info/PKG-INFO
|
||||
norch/norch.egg-info/SOURCES.txt
|
||||
norch/norch.egg-info/dependency_links.txt
|
||||
norch/norch.egg-info/top_level.txt
|
||||
norch/optim/__init__.py
|
||||
norch/optim/optimizer.py
|
||||
norch/optim/optimizers/__init__.py
|
||||
norch/optim/optimizers/sgd.py
|
||||
norch/utils/__init__.py
|
||||
norch/utils/utils.py
|
||||
norch/utils/utils_unittests.py
|
||||
tests/test_autograd.py
|
||||
tests/test_nn.py
|
||||
tests/test_operations.py
|
||||
|
|
@ -1 +0,0 @@
|
|||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
nn
|
||||
optim
|
||||
utils
|
||||
|
|
@ -13,8 +13,8 @@ class CTensor(ctypes.Structure):
|
|||
]
|
||||
|
||||
class Tensor:
|
||||
os.path.abspath(os.curdir)
|
||||
_C = ctypes.CDLL(os.path.join(os.path.abspath(os.curdir), "build/libtensor.so"))
|
||||
module_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
_C = ctypes.CDLL(os.path.join(module_dir, "libtensor.so"))
|
||||
|
||||
def __init__(self, data=None, device="cpu", requires_grad=False):
|
||||
|
||||
|
|
|
|||
23
setup.py
23
setup.py
|
|
@ -1,12 +1,26 @@
|
|||
import setuptools
|
||||
from setuptools.command.install import install
|
||||
import subprocess
|
||||
|
||||
with open("README.md", "r", encoding = "utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
apt_dependencies = [
|
||||
'nvidia-cuda-toolkit'
|
||||
]
|
||||
|
||||
for package in apt_dependencies:
|
||||
subprocess.check_call(['sudo', 'apt', 'install', package])
|
||||
|
||||
class CustomInstall(install):
|
||||
def run(self):
|
||||
subprocess.call(['make', '-C', 'build'])
|
||||
install.run(self)
|
||||
|
||||
|
||||
setuptools.setup(
|
||||
name = "norch",
|
||||
version = "0.0.1",
|
||||
scripts=['install.sh'],
|
||||
author = "Lucas de Lima",
|
||||
author_email = "nogueiralucasdelima@gmail.com",
|
||||
description = "A deep learning framework",
|
||||
|
|
@ -21,7 +35,10 @@ setuptools.setup(
|
|||
"Programming Language :: Python :: 3",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
package_dir = {"": "norch"},
|
||||
packages = setuptools.find_packages(where="norch"),
|
||||
packages = setuptools.find_packages(),
|
||||
package_data={'norch': ['csrc/*', 'libtensor.so']},
|
||||
cmdclass={
|
||||
'install': CustomInstall,
|
||||
},
|
||||
python_requires = ">=3.6"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue