MCPcopy
hub / github.com/TencentARC/Pixal3D / __elemwise__

Method __elemwise__

pixal3d/modules/sparse/basic.py:717–730  ·  view source on GitHub ↗
(self, other: Union[torch.Tensor, VarLenTensor], op: callable)

Source from the content-addressed store, hash-verified

715 return new_cache
716
717 def __elemwise__(self, other: Union[torch.Tensor, VarLenTensor], op: callable) -> 'SparseTensor':
718 if isinstance(other, torch.Tensor):
719 try:
720 other = torch.broadcast_to(other, self.shape)
721 other = other[self.batch_boardcast_map]
722 except:
723 pass
724 if isinstance(other, VarLenTensor):
725 other = other.feats
726 new_feats = op(self.feats, other)
727 new_tensor = self.replace(new_feats)
728 if isinstance(other, SparseTensor):
729 new_tensor._spatial_cache = self.__merge_sparse_cache(other)
730 return new_tensor
731
732 def __getitem__(self, idx):
733 if isinstance(idx, int):

Callers

nothing calls this directly

Calls 2

replaceMethod · 0.95
__merge_sparse_cacheMethod · 0.95

Tested by

no test coverage detected