def forward(self, voxel_features, coors, batch_size): # x = x.contiguous() coors = coors.int() # import pdb # pdb.set_trace() ret = spconv.SparseConvTensor(voxel_features, coors, self.sparse_shape, batch_size) ret = self.downCntx(ret) down1c, down1b = self.resBlock2(ret) down2c, down2b = self.resBlock3(down1c) down3c, down3b = self.resBlock4(down2c) down4c, down4b = self.resBlock5(down3c) up4e = self.upBlock0(down4c, down4b) up3e = self.upBlock1(up4e, down3b) up2e = self.upBlock2(up3e, down2b) up1e = self.upBlock3(up2e, down1b) up0e = self.ReconNet(up1e) up0e = up0e.replace_feature( torch.cat((up0e.features, up1e.features), 1)) logits = self.logits(up0e) y = logits.dense() return y
def forward(self, features, coors, batch_size, enable_timer: bool = False): x = spconv.SparseConvTensor(features, coors, self.shape, batch_size, self.grid, enable_timer=enable_timer) return self.net(x)
def forward(self, x: spconv.SparseConvTensor): inds = x.indices spatial_shape = [x.batch_size, *x.spatial_shape] spatial_stride = [0] * len(spatial_shape) val = 1 for i in range(inds.shape[1] - 1, -1, -1): spatial_stride[i] = val val *= spatial_shape[i] indices_index = inds[:, -1] for i in range(len(spatial_shape) - 1): indices_index += spatial_stride[i] * inds[:, i] _, unique_inds = torch.unique(indices_index) new_inds = inds[unique_inds] new_features = x.features[unique_inds] res = spconv.SparseConvTensor(new_features, new_inds, x.spatial_shape, x.batch_size, x.grid) return res
def forward(self, features, coors, batch_size): x = spconv.SparseConvTensor(features, coors, self.shape, batch_size, self.grid) return self.net(x)
def forward(self, features, coors, batch_size): coors = coors.int() x = spconv.SparseConvTensor(features, coors, self.shape, batch_size) return self.todense(self.net(x)) # .dense()