我正在尝试通过删除train参数来编写旧的chainer代码以与Trainer扩展或手动训练循环一起运行。
[AutoEncoder / StackedAutoEncoder / Regression.py] (https://github.com/quolc/chainer-ML-examples/blob/master/mnist-stacked-autoencoder/net.py)
[Train.py] (https://github.com/quolc/chainer-ML-examples/blob/master/mnist-stacked-autoencoder/train_mnist_sae.py)
train_data_for_next_layer是在稍后进行分层预训练时定义的。当我运行
x = chainer.Variable(xp.array(train_data))
train_data_for_next_layer = cuda.to_cpu(ae.encode(x, train=False).data)
我遇到以下错误:
InvalidType:
Invalid operation is performed in: LinearFunction (Forward)
Expect: x.shape[1] == W.shape[1]
Actual: 784 != 250
只有这样,我才能定义培训。也欢迎任何指向写作培训师的指导。