我正在尝试用Chainer构建一个神经网络,它接受一个4维numpy数组作为输入。
我知道,根据this publication的说法,这是可行的。但是,我看不到在datasets documentation中构建它的方法。
有人知道如何构建它吗?
发布于 2019-09-13 18:07:58
只要输入和输出数据具有相同的长度,您就可以使用任何N维输入:
from chainer.datasets import split_dataset_random, TupleDataset
X = [
[[.04, .46], [.18, .26]],
[[.32, .28], [.21, .12]]
]
Y = [.4, .5] # these are the labels for the X instances, in the same order
train, test = split_dataset_random(TupleDataset(X, Y), int(X.shape[0] * .7))在早期版本中,需要将数组展平为输入向量,但现在您可以使用任何N维数值数组输入。
此外,还可以使用numpy.reshape更改输入的尺寸。
https://stackoverflow.com/questions/57905830
复制相似问题