Skip to content

Commit

Permalink
Generalize int shape check in injector and extractor to take numpy in…
Browse files Browse the repository at this point in the history
…ts (#792)

* update refport unittest to always wait when it writes to port for consistent behavior

Signed-off-by: bamsumit <[email protected]>

* Removed pyproject changes

Signed-off-by: bamsumit <[email protected]>

* Fix to convolution tests. Fixed imcompatible mnist_pretrained for old python versions.

Signed-off-by: bamsumit <[email protected]>

* Missing moudle parent fix

Signed-off-by: bamsumit <[email protected]>

* Added ConvVarModel

* Added iterable callback function

Signed-off-by: bamsumit <[email protected]>

* Fix codacy issues in callback_fx.py

* Fix linting in callback_fx.py

* Fix codacy sig issue in callback_fx.py

* Bugfix to pass the args by keyword

* Delay Dense PyModel fix

Signed-off-by: bamsumit <[email protected]>

* Fixed unittests

Signed-off-by: bamsumit <[email protected]>

* Fixed sparse delay

Signed-off-by: bamsumit <[email protected]>

* IO modules fixes

Signed-off-by: bamsumit <[email protected]>

* IO modules fixes

Signed-off-by: bamsumit <[email protected]>

---------

Signed-off-by: bamsumit <[email protected]>
Co-authored-by: Joyesh Mishra <[email protected]>
Co-authored-by: Marcus G K Williams <[email protected]>
  • Loading branch information
3 people committed Sep 27, 2023
1 parent f8f6cab commit 42c3792
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/lava/proc/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# See: https://spdx.org/licenses/

from . import reset, source, sink, dataloader, encoder
from . import reset, source, sink, dataloader, encoder, injector, extractor

__all__ = ['reset', 'source', 'sink', 'dataloader', 'encoder']
__all__ = ['reset', 'source', 'sink', 'dataloader', 'encoder', 'injector',
'extractor']
4 changes: 2 additions & 2 deletions src/lava/proc/io/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def validate_shape(shape: ty.Tuple[int, ...]):
f"<shape> = {shape}.")

for s in shape:
if not isinstance(s, int):
if not np.issubdtype(type(s), int):
raise TypeError("Expected all elements of <shape> to be of "
f"type int. Got <shape> = {shape}.")
if s <= 0:
Expand All @@ -238,7 +238,7 @@ def validate_buffer_size(buffer_size: int):
buffer_size : int
Buffer size to validate.
"""
if not isinstance(buffer_size, int):
if not np.issubdtype(type(buffer_size), int):
raise TypeError("Expected <buffer_size> to be of type int. Got "
f"<buffer_size> = {buffer_size}.")
if buffer_size <= 0:
Expand Down

0 comments on commit 42c3792

Please sign in to comment.