def METHOD_NAME(metric_device):
    n_iters = 100
    batch_size = 50
    y_true = torch.rand(n_iters * batch_size, 10).to(device)
    y_preds = torch.rand(n_iters * batch_size, 10).to(device)
    def update(engine, i):
        return (
            y_preds[i * batch_size : (i + 1) * batch_size, ...],
            y_true[i * batch_size : (i + 1) * batch_size, ...],
        )
    engine = Engine(update)
    m = MeanPairwiseDistance(device=metric_device)
    m.attach(engine, "mpwd")
    data = list(range(n_iters))
    engine.run(data=data, max_epochs=1)
    y_preds = idist.all_gather(y_preds)
    y_true = idist.all_gather(y_true)
    assert "mpwd" in engine.state.metrics
    res = engine.state.metrics["mpwd"]
    true_res = []
    for i in range(n_iters * idist.get_world_size()):
        true_res.append(
            torch.pairwise_distance(
                y_true[i * batch_size : (i + 1) * batch_size, ...],
                y_preds[i * batch_size : (i + 1) * batch_size, ...],
                p=m._p,
                eps=m._eps,
            )
            .cpu()
            .numpy()
        )
    true_res = np.array(true_res).ravel()
    true_res = true_res.mean()
    assert pytest.approx(res) == true_res