Skip to content
DeepForgeby svx
All problems
EasyGraph Algorithmsgraph-183

Graph Pooling Max

Problem

Aggregate all node feature vectors of a graph with elementwise max pooling.

features is a list of equal-length vectors. Return the coordinate-wise maximum, or an empty list when there are no nodes.

Hint

Max pooling preserves the strongest activation in each coordinate.

Test cases

case 1
in: [[[1,5],[3,2],[0,4]]]
expected: [3,5]
case 2
in: [[[7,1],[2,9]]]
expected: [7,9]
case 3
in: [[]]
expected: []
case 4
in: [[[-1,-2],[-3,-4]]]
expected: [-1,-2]
Starter codePython
def graph_pooling_max(features):
    # Your code here
    pass

4 test cases · run your code against them in the editor