@staticmethod
def _prepare_outputs(outputs: List[List[List[Result]]], batch_mode: bool) -> Union[(List[List[List[Dict]]], List[List[Dict]], List[Dict], Dict)]:
    '\n        Extract required information from batch or epoch end results.\n\n        Args:\n            outputs: A 3-dimensional list of ``Result`` objects with dimensions:\n                [optimizer outs][batch outs][tbptt steps].\n\n            batch_mode: If True, ignore the batch output dimension.\n\n        Returns:\n            The cleaned outputs with ``Result`` objects converted to dictionaries. All list dimensions of size one will\n            be collapsed.\n        '
    processed_outputs = []
    for opt_outputs in outputs:
        if (len(opt_outputs) == 0):
            continue
        processed_batch_outputs = []
        if batch_mode:
            opt_outputs = [opt_outputs]
        for batch_outputs in opt_outputs:
            processed_tbptt_outputs = []
            for tbptt_output in batch_outputs:
                out = tbptt_output.extra
                out['loss'] = tbptt_output.minimize
                processed_tbptt_outputs.append(out)
            if (len(processed_tbptt_outputs) == 1):
                processed_tbptt_outputs = processed_tbptt_outputs[0]
            processed_batch_outputs.append(processed_tbptt_outputs)
        if batch_mode:
            processed_batch_outputs = processed_batch_outputs[0]
        processed_outputs.append(processed_batch_outputs)
    if (len(processed_outputs) == 1):
        processed_outputs = processed_outputs[0]
    return processed_outputs
Extract required information from batch or epoch end results.

Args:
    outputs: A 3-dimensional list of ``Result`` objects with dimensions:
        [optimizer outs][batch outs][tbptt steps].

    batch_mode: If True, ignore the batch output dimension.

Returns:
    The cleaned outputs with ``Result`` objects converted to dictionaries. All list dimensions of size one will
    be collapsed.
@staticmethod
def _prepare_outputs(outputs: List[List[List[Result]]], batch_mode: bool) -> Union[(List[List[List[Dict]]], List[List[Dict]], List[Dict], Dict)]:
    '\n        Extract required information from batch or epoch end results.\n\n        Args:\n            outputs: A 3-dimensional list of ``Result`` objects with dimensions:\n                [optimizer outs][batch outs][tbptt steps].\n\n            batch_mode: If True, ignore the batch output dimension.\n\n        Returns:\n            The cleaned outputs with ``Result`` objects converted to dictionaries. All list dimensions of size one will\n            be collapsed.\n        '
    processed_outputs = []
    for opt_outputs in outputs:
        if (len(opt_outputs) == 0):
            continue
        processed_batch_outputs = []
        if batch_mode:
            opt_outputs = [opt_outputs]
        for batch_outputs in opt_outputs:
            processed_tbptt_outputs = []
            for tbptt_output in batch_outputs:
                out = tbptt_output.extra
                out['loss'] = tbptt_output.minimize
                processed_tbptt_outputs.append(out)
            if (len(processed_tbptt_outputs) == 1):
                processed_tbptt_outputs = processed_tbptt_outputs[0]
            processed_batch_outputs.append(processed_tbptt_outputs)
        if batch_mode:
            processed_batch_outputs = processed_batch_outputs[0]
        processed_outputs.append(processed_batch_outputs)
    if (len(processed_outputs) == 1):
        processed_outputs = processed_outputs[0]
    return processed_outputs