def distance_cost(predictions, targets, img_w):
    """
    repeat predictions and targets to generate all combinations
    use the abs distance as the new distance cost
    """
    num_priors = predictions.shape[0]
    num_targets = targets.shape[0]
    predictions = paddle.repeat_interleave(
        predictions, num_targets, axis=0)[..., 6:]
    targets = paddle.concat(x=num_priors * [targets])[..., 6:]
    invalid_masks = (targets < 0) | (targets >= img_w)
    lengths = (~invalid_masks).sum(axis=1)
    distances = paddle.abs(x=targets - predictions)
    distances[invalid_masks] = 0.0
    distances = distances.sum(axis=1) / (lengths.cast("float32") + 1e-09)
    distances = distances.reshape([num_priors, num_targets])
    return distances

    repeat predictions and targets to generate all combinations
    use the abs distance as the new distance cost
    
ppdet/modeling/assigners/clrnet_assigner.py