jittor_geometric.nn.aggr

Aggregation layers used in Graph Neural Networks.

class jittor_geometric.nn.aggr.Aggregation[source]

Bases: Module

assert_index_present(index)[source]
assert_sorted_index(index)[source]
assert_two_dimensional_input(x, dim)[source]
execute(x, index=None, ptr=None, dim_size=None, dim=-2, max_num_elements=None)[source]

Executes the module computation.

Raises NotImplementedError if the subclass does not override the method.

Return type:

Var

reduce(x, index=None, ptr=None, dim_size=None, dim=-2, reduce='sum')[source]

Perform the aggregation (sum, max, mean, etc.).

Return type:

Var

reset_parameters()[source]

Resets all learnable parameters of the module.

segment(x, ptr, reduce='sum')[source]

Segment operation using ptr, similar to torch_scatter.segment.

Return type:

Var

to_dense_batch(x, index=None, ptr=None, dim_size=None, dim=-2, fill_value=0.0, max_num_elements=None)[source]

Converts the aggregation input into a dense batch.

Return type:

Tuple[Var, Var]

to_dense_batch_helper(x, index, dim_size, fill_value)[source]

Helper function for creating dense batches.

Return type:

Tuple[Var, Var]

class jittor_geometric.nn.aggr.MaxAggregation[source]

Bases: Aggregation

An aggregation operator that takes the feature-wise maximum across a set of elements.

\[\mathrm{max}(\mathcal{X}) = \max_{\mathbf{x}_i \in \mathcal{X}} \mathbf{x}_i.\]
execute(x, index=None, ptr=None, dim_size=None, dim=-2)[source]

Executes the module computation.

Raises NotImplementedError if the subclass does not override the method.

Return type:

Var

class jittor_geometric.nn.aggr.MeanAggregation[source]

Bases: Aggregation

An aggregation operator that averages features across a set of elements.

\[\mathrm{mean}(\mathcal{X}) = \frac{1}{|\mathcal{X}|} \sum_{\mathbf{x}_i \in \mathcal{X}} \mathbf{x}_i.\]
execute(x, index=None, ptr=None, dim_size=None, dim=-2)[source]

Executes the module computation.

Raises NotImplementedError if the subclass does not override the method.

Return type:

Var

class jittor_geometric.nn.aggr.MinAggregation[source]

Bases: Aggregation

An aggregation operator that takes the feature-wise minimum across a set of elements.

\[\mathrm{min}(\mathcal{X}) = \min_{\mathbf{x}_i \in \mathcal{X}} \mathbf{x}_i.\]
execute(x, index=None, ptr=None, dim_size=None, dim=-2)[source]

Executes the module computation.

Raises NotImplementedError if the subclass does not override the method.

Return type:

Var

class jittor_geometric.nn.aggr.MultiAggregation(aggrs, aggrs_kwargs=None, mode='cat', mode_kwargs=None)[source]

Bases: Module

Performs aggregations with one or more aggregators and combines aggregated results, as described in the “Principal Neighbourhood Aggregation for Graph Nets” and “Adaptive Filters and Aggregator Fusion for Efficient Graph Convolutions” papers.

Parameters:
  • aggrs (list) – The list of aggregation schemes to use.

  • aggrs_kwargs (dict, optional) – Arguments passed to the respective aggregation function in case it gets automatically resolved. (default: None).

  • mode (str, optional) – The combine mode to use for combining aggregated results from multiple aggregations. (default: "cat").

  • mode_kwargs (dict, optional) – Arguments passed for the combine mode. (default: None).

combine(inputs)[source]
Return type:

Var

execute(x, index=None, ptr=None, dim_size=None, dim=-2)[source]

Executes the module computation.

Raises NotImplementedError if the subclass does not override the method.

Return type:

Var

get_out_channels(in_channels)[source]
Return type:

int

reset_parameters()[source]
class jittor_geometric.nn.aggr.SumAggregation[source]

Bases: Aggregation

An aggregation operator that sums up features across a set of elements.

\[\mathrm{sum}(\mathcal{X}) = \sum_{\mathbf{x}_i \in \mathcal{X}} \mathbf{x}_i.\]
execute(x, index=None, ptr=None, dim_size=None, dim=-2)[source]

Executes the module computation.

Raises NotImplementedError if the subclass does not override the method.

Return type:

Var