diff --git a/modules/transformation.py b/modules/transformation.py index e543e0c..7c4dd5a 100755 --- a/modules/transformation.py +++ b/modules/transformation.py @@ -90,8 +90,12 @@ class GridGenerator(nn.Module): self.F = F self.C = self._build_C(self.F) # F x 2 self.P = self._build_P(self.I_r_width, self.I_r_height) + ## for multi-gpu, you need register buffer self.register_buffer("inv_delta_C", torch.tensor(self._build_inv_delta_C(self.F, self.C)).float()) # F+3 x F+3 self.register_buffer("P_hat", torch.tensor(self._build_P_hat(self.F, self.C, self.P)).float()) # n x F+3 + ## for fine-tuning with different image width, you may use below instead of self.register_buffer + #self.inv_delta_C = torch.tensor(self._build_inv_delta_C(self.F, self.C)).float().cuda() # F+3 x F+3 + #self.P_hat = torch.tensor(self._build_P_hat(self.F, self.C, self.P)).float().cuda() # n x F+3 def _build_C(self, F): """ Return coordinates of fiducial points in I_r; C """