Skip to content

Commit 2833ff8

Browse files
authored
Introduce param module and refactor surrogate gradients (#63)
* Add parameter transformation module; implement Param class and related transforms * Refactor __init__.py; update __all__ exports to include state module * Add surrogate gradient implementation; create Surrogate class and refactor related modules * Refactor module exports; update __module__ attributes to 'braintools.param' * Add new transformation classes: Positive, Negative, ScaledSigmoid, Power, Ordered, Simplex, and UnitVector; implement log_abs_det_jacobian methods * Update CI configuration; remove develop and release branches from push triggers * Bump version to 0.1.5; update version_info to reflect new version and add support for Python 3.14 in pyproject.toml * Remove lint job from CI configuration; simplify testing setup
1 parent ed4dd19 commit 2833ff8

File tree

13 files changed

+1573
-622
lines changed

13 files changed

+1573
-622
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ on:
44
push:
55
branches:
66
- main
7-
- develop
8-
- 'release/**'
97
pull_request:
10-
branches:
11-
- main
12-
- develop
13-
workflow_call:
8+
149

1510
permissions:
1611
contents: read
@@ -20,25 +15,9 @@ concurrency:
2015
cancel-in-progress: true
2116

2217
jobs:
23-
# lint:
24-
# name: Lint
25-
# runs-on: ubuntu-latest
26-
# steps:
27-
# - uses: actions/checkout@v6
28-
# - uses: actions/setup-python@v6
29-
# with:
30-
# python-version: '3.12'
31-
# cache: pip
32-
# - name: Install pre-commit
33-
# run: |
34-
# python -m pip install --upgrade pip
35-
# pip install pre-commit
36-
# - name: Run pre-commit
37-
# run: pre-commit run --all-files --show-diff-on-failure --color always
3818

3919
tests:
4020
name: Tests (${{ matrix.os }} / py${{ matrix.python }})
41-
# needs: lint
4221
runs-on: ${{ matrix.os }}
4322
strategy:
4423
fail-fast: false

braintools/__init__.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
# ==============================================================================
1515

1616

17-
__version__ = "0.1.4"
18-
__version_info__ = (0, 1, 4)
17+
__version__ = "0.1.5"
18+
__version_info__ = tuple(map(int, __version__.split(".")))
1919

2020
from . import conn
2121
from . import file
2222
from . import init
2323
from . import input
2424
from . import metric
2525
from . import optim
26+
from . import param
2627
from . import quad
2728
from . import surrogate
2829
from . import tree
@@ -31,15 +32,12 @@
3132
from ._spike_encoder import __all__ as encoder_all
3233
from ._spike_operation import *
3334
from ._spike_operation import __all__ as operation_all
34-
from ._transform import *
35-
from ._transform import __all__ as transform_all
3635

3736
__all__ = [
38-
'conn', 'input', 'init',
39-
'file', 'metric', 'visualize',
40-
'optim', 'tree', 'quad',
41-
'surrogate',
42-
]
43-
__all__ = __all__ + encoder_all + transform_all + operation_all
37+
'conn', 'input', 'init',
38+
'file', 'metric', 'visualize',
39+
'optim', 'tree', 'quad',
40+
'surrogate', 'param',
41+
] + encoder_all + operation_all
4442

45-
del encoder_all, transform_all, operation_all
43+
del encoder_all, operation_all

braintools/_transform_test.py

Lines changed: 0 additions & 197 deletions
This file was deleted.

braintools/param/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2025 BrainX Ecosystem Limited. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
16+
from ._base import *
17+
from ._base import __all__ as base_all
18+
from ._state import *
19+
from ._state import __all__ as state_all
20+
from ._transform import *
21+
from ._transform import __all__ as transform_all
22+
23+
__all__ = state_all + transform_all + base_all
24+
25+
del transform_all, base_all, state_all

0 commit comments

Comments
 (0)