(self, input: Union[TensorField, torch.Tensor])
| 394 | self.coordinates = coordinates |
| 395 | |
| 396 | def forward(self, input: Union[TensorField, torch.Tensor]): |
| 397 | if isinstance(input, TensorField): |
| 398 | return input.sparse() |
| 399 | elif isinstance(input, torch.Tensor): |
| 400 | # dense tensor to sparse tensor conversion |
| 401 | if self.remove_zeros: |
| 402 | return to_sparse(input) |
| 403 | else: |
| 404 | return to_sparse_all(input, self.coordinates) |
| 405 | else: |
| 406 | raise ValueError( |
| 407 | "Unsupported type. Only TensorField and torch.Tensor are supported" |
| 408 | ) |
| 409 | |
| 410 | def __repr__(self): |
| 411 | return self.__class__.__name__ + "()" |
nothing calls this directly
no test coverage detected