why use suitable_n? I think this is the size of output.shape[0]. In the case of vector, this is the good size, but in the case of matrix, I think that even if parallelize in the outer loop, we should use the total number of element in the tensor.