Skip to content

Commit

Permalink
use a generator for unpacking in a mem efficient way
Browse files Browse the repository at this point in the history
  • Loading branch information
BalzaniEdoardo committed Dec 15, 2024
1 parent 3333eb7 commit 0c3fc32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nemos/basis/_transformer_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ def _unpack_inputs(self, X: FeatureMatrix) -> List:
"""
n_samples = X.shape[0]
out = [
out = (
np.reshape(X[:, cc : cc + n_input], (n_samples, *bas._input_shape_))
for i, (bas, n_input) in enumerate(
zip(self._list_components(), self._n_basis_input_)
)
for cc in [sum(self._n_basis_input_[:i])]
]
)
return out

def fit(self, X: FeatureMatrix, y=None):
Expand Down

0 comments on commit 0c3fc32

Please sign in to comment.