MCPcopy
hub / github.com/pyg-team/pytorch_geometric / put_tensor

Method put_tensor

torch_geometric/data/feature_store.py:281–300  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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]:

Callers 15

test_num_nodes_sizeFunction · 0.95
update_tensorMethod · 0.95
__setitem__Method · 0.95
create_feature_storeMethod · 0.80
create_dataFunction · 0.80
create_dataFunction · 0.80
test_dist_feature_lookupFunction · 0.80
test_feature_storeFunction · 0.80
test_basic_feature_storeFunction · 0.80
test_basic_feature_storeFunction · 0.80

Calls 3

_put_tensorMethod · 0.95
castMethod · 0.80
is_fully_specifiedMethod · 0.80

Tested by 15

test_num_nodes_sizeFunction · 0.76
create_feature_storeMethod · 0.64
create_dataFunction · 0.64
create_dataFunction · 0.64
test_dist_feature_lookupFunction · 0.64
test_feature_storeFunction · 0.64
test_basic_feature_storeFunction · 0.64
test_basic_feature_storeFunction · 0.64