解决“ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 2 dimension(s)”这个问题。

observations = np.concatenate([p[''] for p in paths])

因为运行结果的奇奇怪怪的导致运行上述代码会出现报错

解决“ValueError: all the input arrays must have same number of dimensions, ...”_解决问题

print之后发现是shape不一样,然后把它们暂时用0补充然后将shape转化为相应的。

x = []
for p in paths:
	if (p['x'].shape==(103,39)):
		x = np.concatenate([p['x']])
	else:
		x_temp = np.pad(p['x'].flatten(), (0, 4017))[:4017].reshape(103, 39)
        x = np.concatenate(obs_temp)
x = np.array(x)