def skip_connections_distance(list_a, list_b):
    """The distance between the skip-connections of two neural networks."""
    distance_matrix = np.zeros((len(list_a), len(list_b)))
    for i, a in enumerate(list_a):
        for j, b in enumerate(list_b):
            distance_matrix[i][j] = skip_connection_distance(a, b)
    return distance_matrix[linear_sum_assignment(distance_matrix)].sum() + abs(
        len(list_a) - len(list_b)
    )
def skip_connections_distance ( list_a , list_b ) : distance_matrix = np . zeros ( ( len ( list_a ) , len ( list_b ) ) ) for i , a in enumerate ( list_a ) : for j , b in enumerate ( list_b ) : distance_matrix [ i ] [ j ] = skip_connection_distance ( a , b ) return distance_matrix [ linear_sum_assignment ( distance_matrix ) ] . sum ( ) + abs ( len ( list_a ) - len ( list_b ) )
The distance between the skip-connections of two neural networks.