我收到此代码的错误消息:
import numpy as np
def transform(X, a=1):
"""
param X: np.array[batch_size, n]
"""
for i in range(np.size(X, 0)):
out = np.copy(X)
x = out[i]
tmp = np.copy(x)
for j in range(x.size):
if (j % 2 == 1):
tmp[j] = a
else:
tmp[j] = tmp[j]**3
out[i] = np.concatenate(x, np.flip(tmp, 0), None)
return out
错误消息:enter image description here
如何修复此功能。期望X是2D数组(数组的数组?) X的X字符串(数组元素)。这是我的程序必须对X的每个字符串执行的示例:enter image description here