Pass all necessary data y, predictions, x to all metrics and use output_transform to filter out required args to existing metrics.
Probably, more elegant way to do this is :

return output as a dictionary with keys like “y” - target, “y_pred” - predictions, “x” for input x.
override _required_output_keys for your custom metric as a tuple ("y", "y_pred", "x")



  
      github.com
  
  
    pytorch/ignite/blob/6faa6ac1e3a46c79e0dfcfd976439b86329717b0/ignite/metrics/metric.py#L129 1

Args:
    output_transform (callable, optional): a callable that is used to transform the
        :class:`~ignite.engine.engine.Engine`'s ``process_function``'s output into the
        form expected by the metric. This can be useful if, for example, you have a multi-output model and
        you want to compute the metric with respect to one of the outputs.
        By default, metrics require the output as ``(y_pred, y)`` or ``{'y_pred': y_pred, 'y': y}``.
    device (str of torch.device, optional): optional device specification for internal storage.

"""

_required_output_keys = ("y_pred", "y")

def __init__(
    self, output_transform: Callable = lambda x: x, device: Optional[Union[str, torch.device]] = None,
):
    self._output_transform = output_transform

    # Check device if distributed is initialized:
    if idist.get_world_size() > 1:

        # check if reset and update methods are decorated. Compute may not be decorated



  
  
    
    
  
  


Thus, I think it can be possible to fetch needed args without using output transform…