Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lava top-level API #745

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9825acc
Added top-level __init__ file to simplify imports for Lava scripts.
mathisrichter Jul 23, 2023
796f781
Added missing blank line at end of file.
mathisrichter Jul 23, 2023
0c1c190
Fixed broken import.
mathisrichter Jul 23, 2023
1bb8065
Explicitly imported and renamed RingBuffer classes.
mathisrichter Jul 23, 2023
d68eb0b
Imported some utils modules.
mathisrichter Jul 23, 2023
f988adb
Imported relevant run-configs.
mathisrichter Jul 23, 2023
0a4d687
Updated all tutorials to use new lava module API.
mathisrichter Jul 28, 2023
0e324f7
Merge branch 'main' of https://github.com/lava-nc/lava into lava_api
mathisrichter Aug 2, 2023
96a00f3
Merge branch 'main' into lava_api
PhilippPlank Aug 7, 2023
cd9bcb4
Merge branch 'main' into lava_api
PhilippPlank Aug 8, 2023
cf7906c
Possible fix for broken tutorial unit tests.
mathisrichter Aug 11, 2023
463aa82
Merge branch 'lava_api' of https://github.com/lava-nc/lava into lava_api
mathisrichter Aug 11, 2023
2d9707a
Removed unnecessary import.
mathisrichter Aug 11, 2023
db67116
Possible tutorial test fix based on importlib.
mathisrichter Aug 11, 2023
edd5821
Ignoring unused imports in init-file.
mathisrichter Aug 11, 2023
d8c9769
Work on importlib solution
mathisrichter Aug 11, 2023
1023f81
Fixed import errors in tutorials.
mathisrichter Aug 11, 2023
3dac858
Unit test for lava module imports.
mathisrichter Aug 11, 2023
83398ef
Removed imports for CLP Processes and Spiker as they are not common.
mathisrichter Aug 11, 2023
971dd9c
Removed noqa from init file
mathisrichter Aug 11, 2023
b7104b8
Added all imports in init file to __all__.
mathisrichter Aug 11, 2023
a58e60a
Fixed broken import in tutorial.
mathisrichter Aug 11, 2023
afd8097
Fixed __all__ to use strings instead of module names.
mathisrichter Aug 11, 2023
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
51 changes: 51 additions & 0 deletions src/lava/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
# See: https://spdx.org/licenses/

# Creates a pkgutil-style namespace package that extends the namespace over
# multiple directory structures.
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

######
# IMPORTS

# Import everything that is relevant to users to the top level to enable
# >>> import lava as lv
# as the only required import for the most common Lava programs.

# PROCESSES
from lava.proc.clp.novelty_detector.process import NoveltyDetector
from lava.proc.clp.nsm.process import Readout, Allocator
from lava.proc.clp.prototype_lif.process import PrototypeLIF
from lava.proc.conv.process import Conv
from lava.proc.dense.process import Dense, DelayDense, LearningDense
from lava.proc.io.dataloader import SpikeDataloader, StateDataloader
from lava.proc.io.source import RingBuffer as SourceRingBuffer
from lava.proc.io.sink import RingBuffer as SinkRingBuffer
from lava.proc.io.encoder import DeltaEncoder
from lava.proc.io.injector import Injector
from lava.proc.io.extractor import Extractor
from lava.proc.io.reset import Reset
from lava.proc.learning_rules.r_stdp_learning_rule import RewardModulatedSTDP
from lava.proc.learning_rules.stdp_learning_rule import STDPLoihi
from lava.proc.lif.process import LIF, LIFReset, LearningLIF, TernaryLIF, \
LIFRefractory
from lava.proc.monitor.process import Monitor
from lava.proc.receiver.process import Receiver
from lava.proc.rf.process import RF
from lava.proc.rf_iz.process import RF_IZ
from lava.proc.sdn.process import Sigma, Delta, SigmaDelta, ActivationMode
from lava.proc.sparse.process import Sparse, LearningSparse, DelaySparse
from lava.proc.spiker.process import Spiker

# RUN CONFIGURATIONS & CONDITIONS
from lava.magma.core.run_configs import Loihi2SimCfg, Loihi2HwCfg
from lava.magma.core.run_conditions import RunContinuous, RunSteps

# MAGMA
from lava.magma.core.process.process import LogConfig

# UTILS
from lava.utils import loihi
from lava.utils import plots
from lava.utils.serialization import save, load
2 changes: 1 addition & 1 deletion src/lava/proc/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# See: https://spdx.org/licenses/

from . import reset, source, sink, dataloader, encoder
from lava.proc.io import reset, source, sink, dataloader, encoder

__all__ = ['reset', 'source', 'sink', 'dataloader', 'encoder']
Loading