def _calc_min_size(self, conv_layers):
    """Calculates the minimum size of the input layer.

    Given a set of convolutional layers, calculate the minimum value of
    the `input_height` and `input_width`, i.e. such that the output has
    size 1x1. Assumes snt.VALID padding.

    Args:
      conv_layers: List of tuples `(output_channels, (kernel_size, stride),
        (pooling_size, pooling_stride))`

    Returns:
      Minimum value of input height and width.
    """
    input_size = 1

    for _, conv_params, max_pooling in reversed(conv_layers):
      if max_pooling is not None:
        kernel_size, stride = max_pooling
        input_size = input_size * stride + (kernel_size - stride)

      if conv_params is not None:
        kernel_size, stride = conv_params
        input_size = input_size * stride + (kernel_size - stride)

    return input_size
def _calc_min_size ( self , conv_layers ) : input_size = 1 for _ , conv_params , max_pooling in reversed ( conv_layers ) : if max_pooling is not None : kernel_size , stride = max_pooling input_size = input_size * stride + ( kernel_size - stride ) if conv_params is not None : kernel_size , stride = conv_params input_size = input_size * stride + ( kernel_size - stride ) return input_size
Calculates the minimum size of the input layer.

    Given a set of convolutional layers, calculate the minimum value of
    the `input_height` and `input_width`, i.e. such that the output has
    size 1x1. Assumes snt.VALID padding.

    Args:
      conv_layers: List of tuples `(output_channels, (kernel_size, stride),
        (pooling_size, pooling_stride))`

    Returns:
      Minimum value of input height and width.