minipypy 0.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- minipypy-0.9.0/.gitignore +35 -0
- minipypy-0.9.0/CMakeLists.txt +86 -0
- minipypy-0.9.0/LICENSE +21 -0
- minipypy-0.9.0/PKG-INFO +1110 -0
- minipypy-0.9.0/README.md +1094 -0
- minipypy-0.9.0/build-test/ALL_BUILD.vcxproj +193 -0
- minipypy-0.9.0/build-test/ALL_BUILD.vcxproj.filters +8 -0
- minipypy-0.9.0/build-test/INSTALL.vcxproj +211 -0
- minipypy-0.9.0/build-test/INSTALL.vcxproj.filters +13 -0
- minipypy-0.9.0/build-test/ZERO_CHECK.vcxproj +181 -0
- minipypy-0.9.0/build-test/ZERO_CHECK.vcxproj.filters +13 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.cp311-win_amd64.iobj +0 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.cp311-win_amd64.pyd.recipe +14 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/CL.17532.write.1.tlog +0 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/CL.command.1.tlog +0 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/CL.read.1.tlog +0 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/Cl.items.tlog +4 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/CustomBuild.command.1.tlog +10 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/CustomBuild.read.1.tlog +138 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/CustomBuild.write.1.tlog +2 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/_C.lastbuildstate +2 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/link.command.1.tlog +0 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/link.read.1.tlog +0 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/link.secondary.1.tlog +4 -0
- minipypy-0.9.0/build-test/_C.dir/Release/_C.tlog/link.write.1.tlog +0 -0
- minipypy-0.9.0/build-test/_C.dir/Release/vcpkg.applocal.log +1 -0
- minipypy-0.9.0/build-test/_C.sln +82 -0
- minipypy-0.9.0/build-test/_C.vcxproj +393 -0
- minipypy-0.9.0/build-test/_C.vcxproj.filters +25 -0
- minipypy-0.9.0/build-test/cmake_install.cmake +68 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/autograd.cu.cache +57 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/autograd.cu1176852746.deps +83 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/CudaCompile.read.1u.tlog +0 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/CudaCompile.write.1u.tlog +0 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/CustomBuild.command.1.tlog +10 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/CustomBuild.read.1.tlog +138 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/CustomBuild.write.1.tlog +2 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/Lib-link.read.1.tlog +0 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/Lib-link.write.1.tlog +0 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/Lib.command.1.tlog +0 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorc.1C249D17.tlog/minitorch_cuda_engine.lastbuildstate +2 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/minitorch_cuda_engine.lib.recipe +11 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/tensor.cu.cache +57 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.dir/Release/tensor.cu327196112.deps +127 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.vcxproj +359 -0
- minipypy-0.9.0/build-test/minitorch_cuda_engine.vcxproj.filters +19 -0
- minipypy-0.9.0/build-test/x64/Release/ALL_BUILD/ALL_BUILD.recipe +17 -0
- minipypy-0.9.0/build-test/x64/Release/ALL_BUILD/ALL_BUILD.tlog/ALL_BUILD.lastbuildstate +2 -0
- minipypy-0.9.0/build-test/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.command.1.tlog +10 -0
- minipypy-0.9.0/build-test/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.read.1.tlog +138 -0
- minipypy-0.9.0/build-test/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.write.1.tlog +2 -0
- minipypy-0.9.0/build-test/x64/Release/ZERO_CHECK/ZERO_CHECK.recipe +11 -0
- minipypy-0.9.0/build-test/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +10 -0
- minipypy-0.9.0/build-test/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +139 -0
- minipypy-0.9.0/build-test/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +2 -0
- minipypy-0.9.0/build-test/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +2 -0
- minipypy-0.9.0/build.ps1 +40 -0
- minipypy-0.9.0/data/MNIST/raw/t10k-images-idx3-ubyte +0 -0
- minipypy-0.9.0/data/MNIST/raw/t10k-images-idx3-ubyte.gz +0 -0
- minipypy-0.9.0/data/MNIST/raw/t10k-labels-idx1-ubyte +0 -0
- minipypy-0.9.0/data/MNIST/raw/t10k-labels-idx1-ubyte.gz +0 -0
- minipypy-0.9.0/data/MNIST/raw/train-images-idx3-ubyte +0 -0
- minipypy-0.9.0/data/MNIST/raw/train-images-idx3-ubyte.gz +0 -0
- minipypy-0.9.0/data/MNIST/raw/train-labels-idx1-ubyte +0 -0
- minipypy-0.9.0/data/MNIST/raw/train-labels-idx1-ubyte.gz +0 -0
- minipypy-0.9.0/docs/architecture.md +1209 -0
- minipypy-0.9.0/examples/benchmark.py +4 -0
- minipypy-0.9.0/examples/linear_regression.py +36 -0
- minipypy-0.9.0/examples/mnist_adam.py +202 -0
- minipypy-0.9.0/examples/mnist_linear.py +201 -0
- minipypy-0.9.0/examples/mnist_tensorfold.py +281 -0
- minipypy-0.9.0/examples/mnist_tensorfold_mlp.py +366 -0
- minipypy-0.9.0/examples/nn_linear_reg.py +31 -0
- minipypy-0.9.0/future/tensorfold.md +1573 -0
- minipypy-0.9.0/minipypy/__init__.py +5 -0
- minipypy-0.9.0/minipypy/nn/__init__.py +3 -0
- minipypy-0.9.0/minipypy/nn/functional.py +28 -0
- minipypy-0.9.0/minipypy/nn/losses.py +22 -0
- minipypy-0.9.0/minipypy/nn/modules.py +211 -0
- minipypy-0.9.0/minipypy/optim/__init__.py +2 -0
- minipypy-0.9.0/minipypy/optim/adam.py +60 -0
- minipypy-0.9.0/minipypy/optim/sgd.py +10 -0
- minipypy-0.9.0/pyproject.toml +34 -0
- minipypy-0.9.0/requirements.txt +0 -0
- minipypy-0.9.0/src/autograd.cpp +472 -0
- minipypy-0.9.0/src/autograd.cu +583 -0
- minipypy-0.9.0/src/autograd.h +93 -0
- minipypy-0.9.0/src/bindings.cpp +294 -0
- minipypy-0.9.0/src/memory_pool.cpp +49 -0
- minipypy-0.9.0/src/memory_pool.h +24 -0
- minipypy-0.9.0/src/tensor.cpp +1670 -0
- minipypy-0.9.0/src/tensor.cu +1365 -0
- minipypy-0.9.0/src/tensor.h +96 -0
- minipypy-0.9.0/tests/test_adam.py +98 -0
- minipypy-0.9.0/tests/test_autograd.py +162 -0
- minipypy-0.9.0/tests/test_backend.py +8 -0
- minipypy-0.9.0/tests/test_bce_with_logits_loss.py +152 -0
- minipypy-0.9.0/tests/test_big_tensors.py +16 -0
- minipypy-0.9.0/tests/test_cross_entropy_loss.py +159 -0
- minipypy-0.9.0/tests/test_hinge_loss.py +72 -0
- minipypy-0.9.0/tests/test_mnist_smoke.py +64 -0
- minipypy-0.9.0/tests/test_nn.py +74 -0
- minipypy-0.9.0/tests/test_optim.py +53 -0
- minipypy-0.9.0/tests/test_relu.py +48 -0
- minipypy-0.9.0/tests/test_scalar_autograd.py +86 -0
- minipypy-0.9.0/tests/test_scalar_ops.py +50 -0
- minipypy-0.9.0/tests/test_sequential.py +73 -0
- minipypy-0.9.0/tests/test_softmax.py +190 -0
- minipypy-0.9.0/tests/test_sqrt.py +34 -0
- minipypy-0.9.0/tests/test_tensorfold_linear.py +123 -0
- minipypy-0.9.0/tests/test_training.py +104 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Build directories
|
|
2
|
+
build/
|
|
3
|
+
dist/
|
|
4
|
+
*.egg-info/
|
|
5
|
+
|
|
6
|
+
# Python
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.pyc
|
|
9
|
+
*.pyo
|
|
10
|
+
|
|
11
|
+
# Virtual environments
|
|
12
|
+
venv/
|
|
13
|
+
wheeltest/
|
|
14
|
+
|
|
15
|
+
# CMake
|
|
16
|
+
CMakeUserPresets.json
|
|
17
|
+
CMakeCache.txt
|
|
18
|
+
CMakeFiles/
|
|
19
|
+
|
|
20
|
+
# IDEs
|
|
21
|
+
.vscode/
|
|
22
|
+
.idea/
|
|
23
|
+
|
|
24
|
+
# Generated binaries
|
|
25
|
+
*.pyd
|
|
26
|
+
*.so
|
|
27
|
+
*.dll
|
|
28
|
+
*.obj
|
|
29
|
+
*.exp
|
|
30
|
+
*.lib
|
|
31
|
+
|
|
32
|
+
# Nsight reports
|
|
33
|
+
*.nsys-rep
|
|
34
|
+
*.sqlite
|
|
35
|
+
*.qdstrm
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
|
2
|
+
|
|
3
|
+
project(_C LANGUAGES CXX CUDA)
|
|
4
|
+
|
|
5
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
6
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
7
|
+
set(CMAKE_CUDA_STANDARD 17)
|
|
8
|
+
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
|
|
9
|
+
|
|
10
|
+
# 1. Locate System & Package Dependencies
|
|
11
|
+
set(Python_FIND_VIRTUALENV FIRST)
|
|
12
|
+
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
|
|
13
|
+
find_package(CUDAToolkit REQUIRED)
|
|
14
|
+
|
|
15
|
+
# 2. Locate pybind11 from the active Python environment
|
|
16
|
+
execute_process(
|
|
17
|
+
COMMAND "${Python_EXECUTABLE}" -c "import pybind11; print(pybind11.get_cmake_dir())"
|
|
18
|
+
OUTPUT_VARIABLE PYBIND11_CMAKE_DIR
|
|
19
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
list(APPEND CMAKE_PREFIX_PATH "${PYBIND11_CMAKE_DIR}")
|
|
23
|
+
find_package(pybind11 REQUIRED)
|
|
24
|
+
|
|
25
|
+
# 3. Create the isolated CUDA Static Engine
|
|
26
|
+
add_library(minitorch_cuda_engine STATIC
|
|
27
|
+
src/tensor.cu
|
|
28
|
+
src/autograd.cu
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Support common NVIDIA GPU architectures:
|
|
32
|
+
# 75 = Turing
|
|
33
|
+
# 80 = Ampere data center
|
|
34
|
+
# 86 = Ampere consumer GPUs, e.g. RTX 30 series
|
|
35
|
+
# 89 = Ada GPUs, e.g. RTX 40 series
|
|
36
|
+
set_target_properties(minitorch_cuda_engine PROPERTIES
|
|
37
|
+
CUDA_ARCHITECTURES "75;80;86;89"
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# 4. Create the Python C++ Extension Module
|
|
41
|
+
pybind11_add_module(_C
|
|
42
|
+
src/bindings.cpp
|
|
43
|
+
src/tensor.cpp
|
|
44
|
+
src/memory_pool.cpp
|
|
45
|
+
src/autograd.cpp
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
target_include_directories(_C PRIVATE
|
|
49
|
+
${CMAKE_SOURCE_DIR}/src
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# 5. Link everything together
|
|
53
|
+
target_link_libraries(_C PRIVATE
|
|
54
|
+
minitorch_cuda_engine
|
|
55
|
+
CUDA::cudart
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# 6. Apply target-specific compile flags cleanly
|
|
59
|
+
if(MSVC)
|
|
60
|
+
target_compile_options(minitorch_cuda_engine PRIVATE
|
|
61
|
+
-O3
|
|
62
|
+
--use_fast_math
|
|
63
|
+
-Xcompiler /wd4819
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
target_compile_options(_C PRIVATE
|
|
67
|
+
/O2
|
|
68
|
+
/W3
|
|
69
|
+
)
|
|
70
|
+
else()
|
|
71
|
+
target_compile_options(minitorch_cuda_engine PRIVATE
|
|
72
|
+
-O3
|
|
73
|
+
--use_fast_math
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
target_compile_options(_C PRIVATE
|
|
77
|
+
-O3
|
|
78
|
+
-Wall
|
|
79
|
+
)
|
|
80
|
+
endif()
|
|
81
|
+
|
|
82
|
+
# 7. Install the compiled Python extension into the minipypy package
|
|
83
|
+
install(TARGETS _C
|
|
84
|
+
LIBRARY DESTINATION minipypy
|
|
85
|
+
RUNTIME DESTINATION minipypy
|
|
86
|
+
)
|
minipypy-0.9.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mridul Bajpai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
21
|
+
IN THE SOFTWARE.
|