The prediction results turned to numpy
logits=model(feature) #If the model is running on a GPU result=logits.data.cpu().numpy() / logits.cpu().numpy() #If the model runs on the CPU result=logits.data.numpy() / logits.numpy()
Turn the matrix into tensor:
np_arr = np.array([1,2,3,4]) tensor=torch.from_numpy(np_arr)
The way to transfer the prediction results of the above Python model with ndarray is the whole content shared by Xiaobian. I hope it can give you a reference, and I hope you can support developpaer more.