adnn 0.7.15__py3-none-any.whl
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.
- adnn/__init__.py +63 -0
- adnn/autograd/__init__.py +35 -0
- adnn/autograd/functional.py +626 -0
- adnn/autograd/grad.py +1136 -0
- adnn/core/__init__.py +62 -0
- adnn/core/ad_context.py +483 -0
- adnn/core/dtype.py +235 -0
- adnn/core/serialization.py +803 -0
- adnn/core/tensordef.py +7412 -0
- adnn/core/tensorfuncs.py +9405 -0
- adnn/cuda.py +392 -0
- adnn/func.py +2080 -0
- adnn/linalg.py +3137 -0
- adnn/nn/__init__.py +39 -0
- adnn/nn/activation.py +704 -0
- adnn/nn/conv.py +1438 -0
- adnn/nn/functional.py +4647 -0
- adnn/nn/init.py +790 -0
- adnn/nn/kan.py +564 -0
- adnn/nn/loss.py +515 -0
- adnn/nn/module.py +5572 -0
- adnn/nn/transformer.py +1101 -0
- adnn/optim/__init__.py +32 -0
- adnn/optim/lr_scheduler.py +539 -0
- adnn/optim/optim.py +2351 -0
- adnn/utils/__init__.py +45 -0
- adnn/utils/data.py +616 -0
- adnn/vision/__init__.py +32 -0
- adnn/vision/datasets.py +1832 -0
- adnn/vision/transforms.py +2149 -0
- adnn-0.7.15.dist-info/METADATA +786 -0
- adnn-0.7.15.dist-info/RECORD +35 -0
- adnn-0.7.15.dist-info/WHEEL +5 -0
- adnn-0.7.15.dist-info/licenses/LICENSE +29 -0
- adnn-0.7.15.dist-info/top_level.txt +1 -0
adnn/__init__.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# BSD 3-Clause License
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2025, Fei Xiang
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
|
8
|
+
#
|
|
9
|
+
# 1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
# list of conditions and the following disclaimer.
|
|
11
|
+
#
|
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
#
|
|
16
|
+
# 3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
|
18
|
+
# this software without specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
# adnn/__init__.py
|
|
32
|
+
|
|
33
|
+
import os
|
|
34
|
+
import sys
|
|
35
|
+
|
|
36
|
+
# 检测 Termux/Android 环境,规避 OpenBLAS 多线程内存管理缺陷
|
|
37
|
+
if 'com.termux' in sys.prefix or 'ANDROID_DATA' in os.environ:
|
|
38
|
+
os.environ.setdefault('OPENBLAS_NUM_THREADS', '1')
|
|
39
|
+
os.environ.setdefault('OMP_NUM_THREADS', '1')
|
|
40
|
+
|
|
41
|
+
# os/sys 只在本文件初始化时使用,用完即清理,避免暴露为 adnn.os / adnn.sys
|
|
42
|
+
del os, sys
|
|
43
|
+
|
|
44
|
+
__version__ = "0.7.15" # 包版本
|
|
45
|
+
|
|
46
|
+
# 定义当使用 `from adnn import *` 时要导出的内容
|
|
47
|
+
# __all__ = []
|
|
48
|
+
|
|
49
|
+
from .core import *
|
|
50
|
+
|
|
51
|
+
from . import autograd
|
|
52
|
+
from . import func
|
|
53
|
+
from . import linalg
|
|
54
|
+
from . import nn
|
|
55
|
+
from . import optim
|
|
56
|
+
from . import utils
|
|
57
|
+
from . import vision
|
|
58
|
+
from . import cuda
|
|
59
|
+
from .cuda import (
|
|
60
|
+
get_default_device,
|
|
61
|
+
set_default_device,
|
|
62
|
+
Device as device
|
|
63
|
+
)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# BSD 3-Clause License
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2025, Fei Xiang
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
|
8
|
+
#
|
|
9
|
+
# 1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
# list of conditions and the following disclaimer.
|
|
11
|
+
#
|
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
#
|
|
16
|
+
# 3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
|
18
|
+
# this software without specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
# 导入grad.py里所有函数,使其成为autograd包的函数
|
|
32
|
+
from .grad import *
|
|
33
|
+
|
|
34
|
+
# 导入functional模块,使其成为autograd包的一个属性
|
|
35
|
+
from . import functional
|