r"""Synchronously adds a :obj:`tensor` to the :class:`FeatureStore`. Returns whether insertion was successful. Args: tensor (torch.Tensor or np.ndarray): The feature tensor to be added. *args: Arguments passed to :class:`TensorAttr`.
(self, tensor: FeatureTensorType, *args, **kwargs)
| 279 | r"""To be implemented by :class:`FeatureStore` subclasses.""" |
| 280 | |
| 281 | def put_tensor(self, tensor: FeatureTensorType, *args, **kwargs) -> bool: |
| 282 | r"""Synchronously adds a :obj:`tensor` to the :class:`FeatureStore`. |
| 283 | Returns whether insertion was successful. |
| 284 | |
| 285 | Args: |
| 286 | tensor (torch.Tensor or np.ndarray): The feature tensor to be |
| 287 | added. |
| 288 | *args: Arguments passed to :class:`TensorAttr`. |
| 289 | **kwargs: Keyword arguments passed to :class:`TensorAttr`. |
| 290 | |
| 291 | Raises: |
| 292 | ValueError: If the input :class:`TensorAttr` is not fully |
| 293 | specified. |
| 294 | """ |
| 295 | attr = self._tensor_attr_cls.cast(*args, **kwargs) |
| 296 | if not attr.is_fully_specified(): |
| 297 | raise ValueError(f"The input TensorAttr '{attr}' is not fully " |
| 298 | f"specified. Please fully-specify the input by " |
| 299 | f"specifying all 'UNSET' fields") |
| 300 | return self._put_tensor(tensor, attr) |
| 301 | |
| 302 | @abstractmethod |
| 303 | def _get_tensor(self, attr: TensorAttr) -> Optional[FeatureTensorType]: |