def METHOD_NAME(self):
    """
    Checks nan/inf existence at all outputs of all layers and raises ValueError only if exist.
    """
    # check forward
    self._check_impl(self.key_to_stat_fwd, "forward")
    # check backward
    self._check_impl(self.key_to_stat_bwd, "backward")