ValueError: Found array with dim 4. Estimator expected <= 2.

python3: ValueError: Found array with dim 4. Estimator expected <= 2.

原因:维度不匹配。数组维度为4维,现在期望的是 <= 2维

方法:改为二维形式。

本人这里是4维度,我改为个数为两维度,如下处理:

 source_x = (source_x.reshape(source_x.shape[0], source_x.shape[1] * source_x.shape[2] * source_x.shape[3]))
 target_x = (target_x.reshape(target_x.shape[0], target_x.shape[1] * target_x.shape[2] * target_x.shape[3]))

你可能感兴趣的:(Python3,python,Error,python3)