torch_geometric.transforms.Constant

class Constant(value: float = 1.0, cat: bool = True, node_types: Optional[Union[str, List[str]]] = None)[source]

Bases: BaseTransform

Appends a constant value to each node feature x (functional name: constant).

Parameters:
  • value (float, optional) – The value to add. (default: 1.0)

  • cat (bool, optional) – If set to False, existing node features will be replaced. (default: True)

  • node_types (str or List[str], optional) – The specified node type(s) to append constant values for if used on heterogeneous graphs. If set to None, constants will be added to each node feature x for all existing node types. (default: None)