Open Khalimat opened 3 years ago
Got the same wrror here Tensor datatype was not supported, but ndarray works for TF
Added X = X.detach().cpu().numpy() y = y.detach().cpu().numpy()
after
X, y = next(iter(dataloader))
, and then it worked. The cause is tensor datatype is not recognized by learner.
In the learner.teach, I modified the y=y_pool[query_idx]
to the code below
learner.teach(X = X, y = torch.from_numpy(y).type(torch.LongTensor), only_new = True)
I added the below code inside the _add_training_data function
self.X_training = self.X_training.detach().cpu().numpy()
self.y_training = self.y_training.detach().cpu().numpy()
then at the end of the teach function i added this
self.X_training = torch.from_numpy(self.X_training)
self.y_training = torch.from_numpy(self.y_training)
Hello, I am trying to reproduce code here. but getting the following error when execute
query_idx, query_instance = learner.query(X_pool, n_instances=100)
TypeError Traceback (most recent call last)