Skip to content

Commit

Permalink
Fix device for initial RHO-LOSS tensor (#525)
Browse files Browse the repository at this point in the history
The initial tensor resides on CPU. For me, it failed when running
RHO-LOSS, since the very first ` self.rho_loss =
torch.cat([self.rho_loss, training_loss -
irreducible_loss]).to(training_loss.dtype)` was on two different
devices, the CPU (initial tensor) and the GPU (training loss and IR
loss). This PR fixes that by moving the initial tensor to the correct
device.
  • Loading branch information
MaxiBoether authored Jun 19, 2024
1 parent 601c2e1 commit 29018c7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ def __init__(
)
self.rho_loss: torch.Tensor = torch.tensor([])
self.number_of_points_seen = 0
self._device = device

def init_downsampler(self) -> None:
self.index_sampleid_map: list[int] = []
self.rho_loss = torch.tensor([])
self.rho_loss = torch.tensor([]).to(self._device)
self.number_of_points_seen = 0

def inform_samples(
Expand Down

0 comments on commit 29018c7

Please sign in to comment.