From d702d3d66be25a0e511d9ece902f4a998a3a43fc Mon Sep 17 00:00:00 2001 From: Yannick DAYER <yannick.dayer@idiap.ch> Date: Mon, 29 Nov 2021 13:09:05 +0100 Subject: [PATCH] Fix unsupported numpy array as `out` parameter. --- bob/learn/em/mixture/gmm.py | 6 +++--- bob/learn/em/test/test_gmm.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bob/learn/em/mixture/gmm.py b/bob/learn/em/mixture/gmm.py index fdab112..5c8c0c0 100644 --- a/bob/learn/em/mixture/gmm.py +++ b/bob/learn/em/mixture/gmm.py @@ -667,14 +667,14 @@ class GMMMachine(BaseEstimator): # Count of samples [int] statistics.t += data.shape[0] # Responsibilities [array of shape (n_gaussians,)] - statistics.n += responsibility.sum(axis=-1) + statistics.n = statistics.n + responsibility.sum(axis=-1) # p * x [array of shape (n_gaussians, n_samples, n_features)] px = np.multiply(responsibility[:, :, None], data[None, :, :]) # First order stats [array of shape (n_gaussians, n_features)] - statistics.sum_px += px.sum(axis=1) + statistics.sum_px = statistics.sum_px + px.sum(axis=1) # Second order stats [array of shape (n_gaussians, n_features)] pxx = np.multiply(px[:, :, :], data[None, :, :]) - statistics.sum_pxx += pxx.sum(axis=1) + statistics.sum_pxx = statistics.sum_pxx + pxx.sum(axis=1) return statistics diff --git a/bob/learn/em/test/test_gmm.py b/bob/learn/em/test/test_gmm.py index 8e39e22..43a9449 100644 --- a/bob/learn/em/test/test_gmm.py +++ b/bob/learn/em/test/test_gmm.py @@ -621,7 +621,7 @@ def test_gmm_ML_2(): def test_gmm_ML_parallel(): - """Trains a GMMMachine with ML_GMMTrainer; compares to an old reference""" + """Trains a GMMMachine with ML_GMMTrainer; compares to a reference""" ar = da.array(load_array(resource_filename("bob.learn.em", "data/dataNormalized.hdf5"))) -- GitLab