ValueError: matrix type must be ‘f‘, ‘d‘, ‘F‘, or ‘D‘ tensorly.decomposition.parafac报错
用tensorly.decomposition.parafac时报错原因是矩阵or张量的元素类型是整型,想办法改成浮点或者double型即可一种思路是利用数据类型的转换函数另一种就是简单粗暴,把24改成24.0即可,例如下面:X = tl.tensor(np.arange(24.0).reshape(3, 4, 2))改完后的代码如下:import numpy as npimport tensorly as tlfrom tensorly.decomposition import paraf