def METHOD_NAME(
    y_pred,
    y,
    data_range,
    metric_device,
    n_iters,
    batch_size,
    atol,
    output_transform=lambda x: x,
    compute_y_channel=False,
):
    def update(engine, i):
        return (
            y_pred[i * batch_size : (i + 1) * batch_size],
            y[i * batch_size : (i + 1) * batch_size],
        )
    engine = Engine(update)
    psnr = PSNR(data_range=data_range, output_transform=output_transform, device=metric_device)
    psnr.attach(engine, "psnr")
    data = list(range(n_iters))
    engine.run(data=data, max_epochs=1)
    y = idist.all_gather(y)
    y_pred = idist.all_gather(y_pred)
    assert "psnr" in engine.state.metrics
    result = engine.state.metrics["psnr"]
    assert result > 0.0
    if compute_y_channel:
        np_y_pred = y_pred[:, 0, ...].cpu().numpy()
        np_y = y[:, 0, ...].cpu().numpy()
    else:
        np_y_pred = y_pred.cpu().numpy()
        np_y = y.cpu().numpy()
    np_psnr = 0
    for np_y_pred_, np_y_ in zip(np_y_pred, np_y):
        np_psnr += ski_psnr(np_y_, np_y_pred_, data_range=data_range)
    assert np.allclose(result, np_psnr / np_y.shape[0], atol=atol)