import numpy as np


def samples2np(data, single=False):
    if single:
        return np.array([sample.ravel() for sample in data])
    return np.array([np.concatenate(sample).ravel() for sample in data])