import torch
from typing import Tuple


def get_output_shape(network: torch.nn.Module, input_shape: Tuple[int, ...]
                     ) -> Tuple[int, ...]:
    """
    Run a dummy forward pass to get the output shape of the backbone.
    Can and should be overridden by subclasses that know the output shape
    without running a dummy forward pass.
    :param input_shape: shape of the input
    :return: output_shape
    """
    placeholder = torch.randn((2, *input_shape), dtype=torch.float)
    with torch.no_grad():
        output = network(placeholder)
    return tuple(output.shape[1:])