“”" the full error “”""
stackedDAE.py", line 89, in pretrain
dae.fit(trloader, valoader, lr=lr, batch_size=batch_size, num_epochs=num_epochs, corrupt=corrupt, loss_type=“mse”)denoisingAutoencoder.py", line 95, in fit
inputs = np.reshape(inputs, [-1, 512])
File “<array_function internals>”, line 6, in reshape
PycharmProjects/test/venv/lib/python3.6/site-packages/numpy/core/_asarray.py", line 85, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: only one element tensors can be converted to Python scalars
“”" the code when the error is generated :
def fit(self, trainloader, validloader, lr=0.001, batch_size=128, num_epochs=10, corrupt=0.3,
loss_type=“mse”):
“”"
data_x: FloatTensor
valid_x: FloatTensor
“”"
use_cuda = torch.cuda.is_available()
if use_cuda:
self.cuda()
print("=====Denoising Autoencoding layer=======")
optimizer = optim.Adam(filter(lambda p: p.requires_grad, self.parameters()), lr=lr)
if loss_type==“mse”:
criterion = MSELoss()
elif loss_type==“cross-entropy”:
criterion = BCELoss()
    # validate
    total_loss = 0.0
    total_num = 0
    for batch_idx, inputs in enumerate(validloader):
        inputs = np.reshape(inputs, [-1, 512])
        #inputs = inputs.view(inputs.size(0), -1).float()
        inputs= torch.Tensor(inputs)
        if use_cuda:
            inputs = inputs.cuda()

        inputs = Variable(inputs)
        hidden = self.encode(inputs)
        if loss_type=="cross-entropy":
            outputs = self.decode(hidden, binary=True)
        else:
            outputs = self.decode(hidden)

thanks a lot if you can help me