Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes aimed at enhancing functionality and improving code quality. The key changes include modifications to the
ProgressBar
handling, updates toXLACustomOp
, and the addition of new classes and methods to support Poisson input functionality.Enhancements to
ProgressBar
handling:brainstate/compile/_loop_collect_return.py
: Updated thepbar
parameter to accept either aProgressBar
instance or an integer, and added type checks and initialization logic accordingly. [1] [2] [3] [4] [5] [6]brainstate/compile/_progress_bar.py
: Added an assertion to ensure that thefreq
parameter is greater than 0 when it is an integer.Updates to
XLACustomOp
:brainstate/event/_fixedprob_mv.py
,brainstate/event/_linear_mv.py
,brainstate/event/_xla_custom_op.py
: Renamedcpu_kernel_generator
andgpu_kernel_generator
tocpu_kernel_or_generator
andgpu_kernel_or_generator
for clarity and consistency. [1] [2] [3] [4] [5] [6]Addition of Poisson input functionality:
brainstate/nn/_dyn_impl/_inputs.py
: Introduced thePoissonInput
class andpoisson_input
function to generate Poisson input for a givenbrainstate.State
. [1] [2]Other notable changes:
brainstate/event/__init__.py
: Refactored imports and updated the__all__
list for better module organization.brainstate/event/_csr_test.py
: Added a new test file with unit tests for theCSR
class.brainstate/graph/_graph_node.py
: Introducedgraph_invisible_attrs
to manage node attributes that should be ignored during graph operations. [1] [2]brainstate/nn/_dynamics/_dynamics_base.py
: Addedgraph_invisible_attrs
and new methodsget_item_value
andget_item
to theDynamics
class. [1] [2]