我有一个numpy数组的列表,这些列表将由生成器作为输入提供给神经网络模型。但是,numpy数组的形状可以不同(*,1),其中*是为每个图像填充的动态数字。我如何在生成器中编写它?我试图在神经网络模型中给出这样的结果。
preds = Input(shape=(None,1),name='preds')
在生成器中,我正在尝试提供以下内容:
result = np.zeros((batchsize,None,1))
for i in range(batch_size):
result[i,:,:]=predictions
但这给了我TypeError: 'NoneType' object cannot be interpreted as an integer
声明np.zeros(batchsize,1)
中的错误。为numpy数组赋予动态形状的正确方法是什么?