Skip to content
Snippets Groups Projects
Commit 3b64549d authored by Schneider Leo's avatar Schneider Leo
Browse files

fix : float double error

parent e7d055b2
No related branches found
No related tags found
No related merge requests found
...@@ -80,9 +80,9 @@ def train_model(config,args): ...@@ -80,9 +80,9 @@ def train_model(config,args):
param.requires_grad = True param.requires_grad = True
for imaer, imana, img_ref, label in data_train: for imaer, imana, img_ref, label in data_train:
imaer.float() imaer = imaer.float()
imana.float() imana = imana.float()
img_ref.float() img_ref = img_ref.float()
label = label.long() label = label.long()
if torch.cuda.is_available(): if torch.cuda.is_available():
imaer = imaer.cuda() imaer = imaer.cuda()
...@@ -112,9 +112,9 @@ def train_model(config,args): ...@@ -112,9 +112,9 @@ def train_model(config,args):
param.requires_grad = False param.requires_grad = False
for imaer, imana, img_ref, label in data_val_batch: for imaer, imana, img_ref, label in data_val_batch:
imaer.float() imaer = imaer.float()
imana.float() imana = imana.float()
img_ref.float() img_ref = img_ref.float()
imaer = imaer.transpose(0, 1) imaer = imaer.transpose(0, 1)
imana = imana.transpose(0, 1) imana = imana.transpose(0, 1)
img_ref = img_ref.transpose(0, 1) img_ref = img_ref.transpose(0, 1)
...@@ -183,7 +183,7 @@ def test_model(best_result, args): ...@@ -183,7 +183,7 @@ def test_model(best_result, args):
# load model # load model
model = Classification_model_duo_contrastive(model=args.model, n_class=2) model = Classification_model_duo_contrastive(model=args.model, n_class=2)
model.double() model.float()
# load weight # load weight
checkpoint_path = os.path.join(best_result.checkpoint.to_directory(), "checkpoint.pt") checkpoint_path = os.path.join(best_result.checkpoint.to_directory(), "checkpoint.pt")
...@@ -209,6 +209,9 @@ def test_model(best_result, args): ...@@ -209,6 +209,9 @@ def test_model(best_result, args):
param.requires_grad = False param.requires_grad = False
for imaer, imana, img_ref, label in data_val_batch: for imaer, imana, img_ref, label in data_val_batch:
imaer = imaer.float()
imana = imana.float()
img_ref = img_ref.float()
imaer = imaer.transpose(0, 1) imaer = imaer.transpose(0, 1)
imana = imana.transpose(0, 1) imana = imana.transpose(0, 1)
img_ref = img_ref.transpose(0, 1) img_ref = img_ref.transpose(0, 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment