Skip to content

Conversation

chaoming0625
Copy link
Collaborator

No description provided.

chaoming0625 and others added 30 commits June 1, 2025 21:26
…nclude brainstate, brainunit, and brainevent
This commit introduces a `pyproject.toml` file to enable seamless installation using UV, the modern Python package installer.
All calls to bm.clear_buffer_memory() in test_aligns.py have been commented out, likely to prevent buffer clearing during test execution or debugging. Additionally, the unused reduce_axes argument and its documentation were removed from grad() in autograd.py for code simplification.
Renamed the Base class in ndarray.py to BaseArray and updated all references in related modules, including Array and Variable. Also fixed the while_loop wrapper in controls.py to correctly unpack operands for the body and condition functions. Uncommented bm.clear_buffer_memory() calls in test_aligns.py to ensure buffer memory is cleared after tests.
Introduced a private method to ensure the random state value exists and is valid. If the value is deleted, it is regenerated before being accessed.
Replaces all references to 'Array' with 'BaseArray' in type checks and imports to align with updated class naming. This improves consistency and clarity in the codebase.
Updated the _ensure_value_exists method to properly check the type of self._value and only regenerate the random state if it is not a numpy array, not a JAX Tracer, and has been deleted. This prevents unnecessary regeneration and ensures correct handling of different value types.
Updated the scan function to use correct argument names ('f' and 'pbar') for brainstate.transform.scan. Fixed while_loop to properly wrap cond_fun in a lambda, matching the expected signature.
# Conflicts:
#	brainpy/_src/math/object_transform/controls.py
chaoming0625 and others added 18 commits July 30, 2025 23:49
Updated the ifelse function to ensure branches are callable and to convert condition chains into mutually exclusive conditions, improving compatibility with brainstate. Modified while_loop to fallback to a native Python loop when the condition function modifies state, addressing issues with write states in brainstate.transform.while_loop.
Implemented __eq__, __ne__, __lt__, __le__, __gt__, and __ge__ in the Variable class to provide element-wise comparison using BaseArray behavior. This ensures Variable instances support intuitive comparison operations consistent with array semantics.
Enhanced the while_loop function to detect JIT context and avoid using Python while loops when operands are JAX tracers, raising an error instead. Updated tests to reflect correct state changes and to assert that JIT compilation fails when the condition function modifies state.
Added checks for missing fit records in Dense and OfflineTrainer to prevent errors when fit records are absent. Updated tests to reset random state for isolation and to accept both numpy and JAX arrays, improving compatibility and test reliability.
Replaces direct pytest invocation in CI with a new pytest_groups.py script that runs known problematic tests in isolation to avoid state pollution. Updates test_jit.py to reset random seeds and clear state before tests, improving test reproducibility and reliability.
Enhanced the BrainPy minimal test runner with clearer output formatting, timing for each test group, and summary statistics. Now displays pass/fail status with durations, extracts recent failures for easier debugging, and provides a concise summary of test results.
Replaces emoji icons (such as checkmarks and crosses) in test status print statements with plain text equivalents for improved readability and compatibility in environments that may not support emojis.
Enhanced pytest_groups.py to support parallel execution via pytest-xdist, updated documentation and environment variable handling, and improved isolation for problematic tests. Added new files to the isolated test list to prevent state conflicts and blocking issues. requirements-dev.txt updated to include pytest-xdist. Minor fix in test_abstract_models.py to ensure dt is set. Synchronized dt setting in environment.py with brainstate.environ.
Enhanced the output shown in GitHub Actions when tests fail by displaying detailed stdout and stderr, and providing a more comprehensive summary of failed and errored tests. This makes it easier to diagnose issues in CI by surfacing more relevant information from test failures.
…ance, reorganizing imports, and refining function definitions
@chaoming0625 chaoming0625 merged commit f811506 into master Jul 31, 2025
50 of 51 checks passed
@chaoming0625 chaoming0625 deleted the update branch July 31, 2025 15:17
This was referenced Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants