device
='cuda' if x0.is_cuda else 'cpu'
FeatsL=self.feature(x0)
FeatsR=self.feature(x1)
+
Offset_pos=- (0.5) * torch.rand(dispnoc0.size(),device=device) + (0.5)
Offset_neg=((self.false1 - self.false2) * torch.rand(dispnoc0.size(),device=device) + self.false2)
RandSens=torch.rand(dispnoc0.size(),device=device)
RandSens=((RandSens < 0.5).float()+(RandSens >= 0.5).float()*(-1.0))
+
Offset_pos=Offset_pos*RandSens
Offset_neg=Offset_neg*RandSens
#dispnoc0=torch.nan_to_num(dispnoc0, nan=0.0)
-
D_pos=dispnoc0
+
D_pos=dispnoc0+Offset_pos
D_neg=dispnoc0+Offset_neg
Index_X=torch.arange(0,dispnoc0.size()[-1],device=device)
Index_X=Index_X.expand(dispnoc0.size()[-2],dispnoc0.size()[-1]).unsqueeze(0).unsqueeze(0).repeat_interleave(x0.size()[0],0)
@@ -389,12 +393,14 @@
Source code for simlearner3d.models.generic_model
device='cuda' if x0.is_cuda else 'cpu'
FeatsL=self.feature(x0)
FeatsR=self.feature(x1)
+ Offset_pos=- (0.5) * torch.rand(dispnoc0.size(),device=device) + (0.5)
Offset_neg=((self.false1 - self.false2) * torch.rand(dispnoc0.size(),device=device) + self.false2)
RandSens=torch.rand(dispnoc0.size(),device=device)
RandSens=((RandSens < 0.5).float()+(RandSens >= 0.5).float()*(-1.0))
+ Offset_pos=Offset_pos*RandSens
Offset_neg=Offset_neg*RandSens
#dispnoc0=torch.nan_to_num(dispnoc0, nan=0.0)
- D_pos=dispnoc0
+ D_pos=dispnoc0+Offset_pos
D_neg=dispnoc0+Offset_neg
Index_X=torch.arange(0,dispnoc0.size()[-1],device=device)
Index_X=Index_X.expand(dispnoc0.size()[-2],dispnoc0.size()[-1]).unsqueeze(0).unsqueeze(0).repeat_interleave(x0.size()[0],0)