Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the bug of tensors not on the same device when running on CUDA device #59

Merged
merged 10 commits into from
Apr 19, 2023
Merged
Prev Previous commit
Next Next commit
fix: apply _assemble_input_for_testing in SAITS and Transformer's imp…
…ute() to map data to the proper device;
  • Loading branch information
WenjieDu committed Apr 19, 2023
commit 108d297978d8d8f66b595d16eecc1f1eaffc7524
2 changes: 1 addition & 1 deletion pypots/imputation/saits.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def impute(

with torch.no_grad():
for idx, data in enumerate(test_loader):
inputs = {"X": data[1], "missing_mask": data[2]}
inputs = self._assemble_input_for_testing(data)
imputed_data = self.model.impute(inputs)
imputation_collector.append(imputed_data)

Expand Down
2 changes: 1 addition & 1 deletion pypots/imputation/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def impute(self, X: Union[dict, str], file_type: str = "h5py") -> np.ndarray:

with torch.no_grad():
for idx, data in enumerate(test_loader):
inputs = {"X": data[1], "missing_mask": data[2]}
inputs = self._assemble_input_for_testing(data)
imputed_data = self.model.impute(inputs)
imputation_collector.append(imputed_data)

Expand Down