Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions brainpy/dnn/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def offline_fit(self,
self.W.value = Wff
self.b.value = bias[0]

def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder (with an `onn_post` typo); concrete overrides declare explicit params
def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder; concrete overrides declare explicit params
self,
on_pre: Optional[Dict] = None,
on_post: Optional[Dict] = None,
Expand Down Expand Up @@ -334,7 +334,7 @@ def update(self, pre_val):
post_val = pre_val @ self.weight
return post_val

def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder (with an `onn_post` typo); concrete overrides declare explicit params
def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder; concrete overrides declare explicit params
self,
on_pre: Optional[Dict] = None,
on_post: Optional[Dict] = None,
Expand Down Expand Up @@ -397,7 +397,7 @@ def __init__(
def update(self, pre_val):
return pre_val * self.weight

def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder (with an `onn_post` typo); concrete overrides declare explicit params
def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder; concrete overrides declare explicit params
self,
on_pre: Optional[Dict] = None,
on_post: Optional[Dict] = None,
Expand Down Expand Up @@ -484,7 +484,7 @@ def __init__(
def update(self, x):
return x @ self.mask_fun(self.weight * self.mask)

def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder (with an `onn_post` typo); concrete overrides declare explicit params
def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder; concrete overrides declare explicit params
self,
on_pre: Optional[Dict] = None,
on_post: Optional[Dict] = None,
Expand Down Expand Up @@ -535,7 +535,7 @@ def __init__(
w = bm.TrainVar(w)
self.weight = w

def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder (with an `onn_post` typo); concrete overrides declare explicit params
def stdp_update( # type: ignore[override] # base SupportSTDP.stdp_update is a permissive *args/**kwargs placeholder; concrete overrides declare explicit params
self,
on_pre: Optional[Dict] = None,
on_post: Optional[Dict] = None,
Expand Down
2 changes: 1 addition & 1 deletion brainpy/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,5 +544,5 @@ class SupportSTDP(MixIn):
"""Support synaptic plasticity by modifying the weights.
"""

def stdp_update(self, *args, on_pre=None, onn_post=None, **kwargs):
def stdp_update(self, *args, on_pre=None, on_post=None, **kwargs):
raise NotImplementedError
4 changes: 2 additions & 2 deletions brainpy/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ def predict(
"""

if inputs_are_batching is not None:
raise warnings.warn( # type: ignore[misc] # latent bug: warnings.warn returns None; preserved to avoid behavior change
warnings.warn(
f'''
`inputs_are_batching` is no longer supported.
`inputs_are_batching` is no longer supported.
The target mode of {self.target.mode} has already indicated the input should be batching.
''',
UserWarning
Comment on lines +455 to 460

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Refine the warning to give a clearer location and potentially a more specific warning type.

With the misuse of raise warnings.warn(...) corrected, consider setting an appropriate stacklevel (e.g., stacklevel=2) so the warning points to the caller instead of the runner internals. Since this concerns a deprecated argument, using DeprecationWarning or a dedicated warning subclass instead of UserWarning would better express the deprecation intent.

Expand Down
Loading