pocket-inference 0.1.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.
Files changed (32) hide show
  1. pocket_inference-0.1.0/.clippy.toml +11 -0
  2. pocket_inference-0.1.0/.github/dependabot.yml +24 -0
  3. pocket_inference-0.1.0/.github/workflows/ci.yml +88 -0
  4. pocket_inference-0.1.0/.github/workflows/release.yml +90 -0
  5. pocket_inference-0.1.0/.gitignore +57 -0
  6. pocket_inference-0.1.0/Cargo.lock +1497 -0
  7. pocket_inference-0.1.0/Cargo.toml +34 -0
  8. pocket_inference-0.1.0/LICENSE-APACHE +190 -0
  9. pocket_inference-0.1.0/LICENSE-MIT +21 -0
  10. pocket_inference-0.1.0/PKG-INFO +137 -0
  11. pocket_inference-0.1.0/README.md +107 -0
  12. pocket_inference-0.1.0/assets/logo.svg +35 -0
  13. pocket_inference-0.1.0/pyproject.toml +41 -0
  14. pocket_inference-0.1.0/rustfmt.toml +24 -0
  15. pocket_inference-0.1.0/src/activations.rs +390 -0
  16. pocket_inference-0.1.0/src/conv2d_impl.rs +118 -0
  17. pocket_inference-0.1.0/src/error.rs +36 -0
  18. pocket_inference-0.1.0/src/layers/batch_normalization.rs +230 -0
  19. pocket_inference-0.1.0/src/layers/conv2d.rs +233 -0
  20. pocket_inference-0.1.0/src/layers/dense.rs +160 -0
  21. pocket_inference-0.1.0/src/layers/dropout.rs +31 -0
  22. pocket_inference-0.1.0/src/layers/flatten.rs +69 -0
  23. pocket_inference-0.1.0/src/layers/mod.rs +26 -0
  24. pocket_inference-0.1.0/src/layers/pooling.rs +297 -0
  25. pocket_inference-0.1.0/src/lib.rs +37 -0
  26. pocket_inference-0.1.0/src/model/loader.rs +500 -0
  27. pocket_inference-0.1.0/src/model/mod.rs +5 -0
  28. pocket_inference-0.1.0/src/model/sequential.rs +120 -0
  29. pocket_inference-0.1.0/src/python.rs +72 -0
  30. pocket_inference-0.1.0/src/tensor.rs +97 -0
  31. pocket_inference-0.1.0/tests/layers.rs +229 -0
  32. pocket_inference-0.1.0/tests/tensor.rs +118 -0
@@ -0,0 +1,11 @@
1
+ # Clippy configuration for pocket-inference
2
+
3
+ # Pedantic warnings we want to allow
4
+ allow-unwrap-in-tests = true
5
+ allow-expect-in-tests = true
6
+
7
+ # Performance
8
+ too-many-arguments-threshold = 8
9
+
10
+ # Cognitive complexity threshold
11
+ cognitive-complexity-threshold = 30
@@ -0,0 +1,24 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "cargo"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ open-pull-requests-limit: 10
8
+ labels:
9
+ - "dependencies"
10
+ - "rust"
11
+ commit-message:
12
+ prefix: "cargo"
13
+ include: "scope"
14
+
15
+ - package-ecosystem: "github-actions"
16
+ directory: "/"
17
+ schedule:
18
+ interval: "weekly"
19
+ open-pull-requests-limit: 5
20
+ labels:
21
+ - "dependencies"
22
+ - "github-actions"
23
+ commit-message:
24
+ prefix: "ci"
@@ -0,0 +1,88 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main, develop ]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+ RUST_BACKTRACE: 1
12
+
13
+ jobs:
14
+ test:
15
+ name: Test Suite
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ os: [ubuntu-latest, macos-latest]
21
+ rust: [stable]
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Install Rust toolchain
27
+ uses: dtolnay/rust-toolchain@master
28
+ with:
29
+ toolchain: ${{ matrix.rust }}
30
+
31
+ - name: Install HDF5 (Ubuntu)
32
+ if: runner.os == 'Linux'
33
+ run: |
34
+ sudo apt-get update
35
+ sudo apt-get install -y libhdf5-dev pkg-config
36
+
37
+ - name: Install HDF5 (macOS)
38
+ if: runner.os == 'macOS'
39
+ run: |
40
+ # Install HDF5 1.10 (hdf5-sys 0.8.1 doesn't support 1.14)
41
+ brew install pkg-config
42
+ brew install hdf5@1.10
43
+ HDF5_DIR=$(brew --prefix hdf5@1.10)
44
+ echo "HDF5_DIR=$HDF5_DIR" >> $GITHUB_ENV
45
+ echo "HDF5_ROOT=$HDF5_DIR" >> $GITHUB_ENV
46
+ echo "PKG_CONFIG_PATH=$HDF5_DIR/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
47
+ echo "DYLD_LIBRARY_PATH=$HDF5_DIR/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
48
+
49
+ - name: Build
50
+ run: cargo build --verbose
51
+
52
+ - name: Run tests
53
+ run: cargo test --verbose
54
+
55
+ clippy:
56
+ name: Clippy
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - name: Checkout code
60
+ uses: actions/checkout@v4
61
+
62
+ - name: Install Rust toolchain
63
+ uses: dtolnay/rust-toolchain@stable
64
+ with:
65
+ components: clippy
66
+
67
+ - name: Install HDF5
68
+ run: |
69
+ sudo apt-get update
70
+ sudo apt-get install -y libhdf5-dev pkg-config
71
+
72
+ - name: Run clippy
73
+ run: cargo clippy --all-features
74
+
75
+ fmt:
76
+ name: Formatting
77
+ runs-on: ubuntu-latest
78
+ steps:
79
+ - name: Checkout code
80
+ uses: actions/checkout@v4
81
+
82
+ - name: Install Rust toolchain
83
+ uses: dtolnay/rust-toolchain@stable
84
+ with:
85
+ components: rustfmt
86
+
87
+ - name: Check formatting
88
+ run: cargo fmt --all -- --check
@@ -0,0 +1,90 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+ inputs:
8
+ target:
9
+ description: "Upload destination"
10
+ default: "testpypi"
11
+ type: choice
12
+ options:
13
+ - testpypi
14
+ - pypi
15
+
16
+ jobs:
17
+ build-linux:
18
+ name: Build wheels (Linux ${{ matrix.target }})
19
+ runs-on: ${{ matrix.runner }}
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ include:
24
+ - target: x86_64
25
+ runner: ubuntu-latest
26
+ - target: aarch64
27
+ runner: ubuntu-24.04-arm
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+
31
+ - uses: PyO3/maturin-action@v1
32
+ with:
33
+ target: ${{ matrix.target }}
34
+ manylinux: "2_28"
35
+ args: --release --out dist --features python
36
+
37
+ - uses: actions/upload-artifact@v4
38
+ with:
39
+ name: wheels-linux-${{ matrix.target }}
40
+ path: dist
41
+
42
+ build-macos:
43
+ name: Build wheels (macOS aarch64)
44
+ runs-on: macos-latest
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+
48
+ - uses: PyO3/maturin-action@v1
49
+ with:
50
+ target: aarch64-apple-darwin
51
+ args: --release --out dist --features python
52
+
53
+ - uses: actions/upload-artifact@v4
54
+ with:
55
+ name: wheels-macos-aarch64
56
+ path: dist
57
+
58
+ sdist:
59
+ name: Build sdist
60
+ runs-on: ubuntu-latest
61
+ steps:
62
+ - uses: actions/checkout@v4
63
+
64
+ - uses: PyO3/maturin-action@v1
65
+ with:
66
+ command: sdist
67
+ args: --out dist
68
+
69
+ - uses: actions/upload-artifact@v4
70
+ with:
71
+ name: sdist
72
+ path: dist
73
+
74
+ publish:
75
+ name: Publish to ${{ github.event_name == 'push' && 'PyPI' || inputs.target }}
76
+ needs: [build-linux, build-macos, sdist]
77
+ runs-on: ubuntu-latest
78
+ environment:
79
+ name: ${{ github.event_name == 'push' && 'pypi' || inputs.target }}
80
+ permissions:
81
+ id-token: write
82
+ steps:
83
+ - uses: actions/download-artifact@v4
84
+ with:
85
+ path: dist
86
+ merge-multiple: true
87
+
88
+ - uses: pypa/gh-action-pypi-publish@release/v1
89
+ with:
90
+ repository-url: ${{ (github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi') && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
@@ -0,0 +1,57 @@
1
+ # Rust
2
+ /target/
3
+ **/*.rs.bk
4
+ Cargo.lock
5
+
6
+ # Python
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+ *.so
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ *.whl
28
+
29
+ # Virtual environments
30
+ venv/
31
+ ENV/
32
+ env/
33
+ .venv/
34
+ .venv-*/
35
+
36
+ # IDEs
37
+ .vscode/
38
+ .idea/
39
+ *.swp
40
+ *.swo
41
+ *~
42
+
43
+ # Generated model files
44
+ *.h5
45
+ *.hdf5
46
+ *.keras
47
+ examples/data/
48
+
49
+ # Temporary files
50
+ *.tmp
51
+ inspect_*.py
52
+ test_*.py
53
+ run_example.sh
54
+
55
+ # OS
56
+ .DS_Store
57
+ Thumbs.db