(self, other: Union[torch.Tensor, VarLenTensor], op: callable)
| 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): |
nothing calls this directly
no test coverage detected