Read the feature by index. Parameters ---------- ids : torch.Tensor, optional The index of the feature. If specified, only the specified indices of the feature are read. If None, the entire feature is returned. Returns -------
(self, ids: torch.Tensor = None)
| 50 | self._offset = offset |
| 51 | |
| 52 | def read(self, ids: torch.Tensor = None): |
| 53 | """Read the feature by index. |
| 54 | |
| 55 | Parameters |
| 56 | ---------- |
| 57 | ids : torch.Tensor, optional |
| 58 | The index of the feature. If specified, only the specified indices |
| 59 | of the feature are read. If None, the entire feature is returned. |
| 60 | |
| 61 | Returns |
| 62 | ------- |
| 63 | torch.Tensor |
| 64 | The read feature. |
| 65 | """ |
| 66 | if ids is None: |
| 67 | return self._fallback_feature.read() |
| 68 | return self._feature.query_and_replace( |
| 69 | ids.cpu(), self._fallback_feature.read, self._offset |
| 70 | ).to(ids.device) |
| 71 | |
| 72 | def read_async(self, ids: torch.Tensor): |
| 73 | r"""Read the feature by index asynchronously. |
no test coverage detected