def stack(x, filters, num_blocks, block_fn, use_bias, stride1=2, name=None):
    """A set of stacked residual blocks.

    Arguments:
      x: input tensor.
      filters: integer, filters of the bottleneck layer in a block.
      use_bias: boolean, enables or disables all biases in conv layers.
      num_blocks: integer, blocks in the stacked blocks.
      block_fn: a function of a block to stack.
      stride1: default 2, stride of the first layer in the first block.
      name: string, stack label.

    Returns:
      Output tensor for the stacked blocks.
    """
    x = block_fn(x, filters, conv_shortcut=True, stride=stride1, use_bias=use_bias, name=f'{name}_block1')
    for i in range(2, num_blocks + 1):
        x = block_fn(x, filters, use_bias=use_bias, name=f'{name}_block{i}')
    return x