Fix Python – How to fix RuntimeError “Expected object of scalar type Float but got scalar type Double for argument”?

I’m trying to train a classifier via PyTorch. However, I am experiencing problems with training when I feed the model with training data.
I get this error on y_pred = model(X_trainTensor):

RuntimeError: Expected object of scalar type Float but got scalar type Double for argument #4 ‘mat1’

Here are key parts of my code:
# Hyper-parameters
D_in =….

Fix Python – Save classifier to disk in scikit-learn

How do I save a trained Naive Bayes classifier to disk and use it to predict data?
I have the following sample program from the scikit-learn website:
from sklearn import datasets
iris = datasets.load_iris()
from sklearn.naive_bayes import GaussianNB
gnb = GaussianNB()
y_pred = gnb.fit(iris.data, iris.target).predict(iris.data)
print “Number of mis….