Hello all,
I have an autoencoder based model, from which I extract the encoded state and further put it into a support vector classifier(sklearn.svm.SVC) to classify. However, when converting the list of the encoded states(either explicitly or as scikit learn does implicitly) I get the error as mentioned in the subject.
Encoded tensor is of the shape - [1, 1, 313]
ValueError: only one element tensors can be converted to Python scalars

And here is my entire pipeline -
train_numpy = []
train_labels = []
model = Encoder()
model.load_state_dict(torch.load('path/encoder.pth'))
model.eval()
for param in model.parameters():
    param.requires_grad = False

for (x,y) in train_Data:
    encoded, out = model(x)
    encoded = encoded.squeeze().detach().numpy()
    y = y.squeeze().detach().numpy()
   train_numpy.append(x)
    train_labels.append(y)

train_numpy = numpy.asarray(train_numpy)
train_labels = numpy.asarray(train_labels)

SVM = svm.SVC(kernel='rbf')
SVM.fit(X=train_numpy, y=train_labels)

Could someone please point what could be going wrong,
Thanks in Advance