code: def expected_seq_size(
      seq_size: int,  # input max sequence length
      padding: str,  # conv1d padding: 'same' or 'valid'
      kernel_size: int,  # conv1d kernel size
      stride: int,  # conv1d stride
      dilation: int,  # conv1d dilation rate
      pool_size: Union[None, int],  # pooling layer kernel size
      pool_padding: str,  # pooling layer padding: 'same' or 'valid'
      pool_stride: int,  # pooling layer stride
  ) -> int:
      # output shape for the convolutional layer
      output_seq_size = get_img_output_shape(
          img_height=0,  # img_height set to zero for 1D structure
          img_width=seq_size,  # img_width equates to max sequence length
          kernel_size=kernel_size,
          stride=stride,
          padding=padding,
          dilation=dilation,
      )
      if pool_size is not None:
          # pooling layer present, adjust expected output shape for pooling layer
          output_seq_size = get_img_output_shape(
              img_height=0,  # img_height set to zero for 1D structure
              img_width=output_seq_size[
                  1
              ],  # img_width equates to max sequence length
              kernel_size=pool_size,
              stride=pool_stride,
              padding=pool_padding,
              dilation=1,  # pooling layer only support unit dilation
          )
      return output_seq_size[1]
  
file_path: ludwig/tests/ludwig/modules/test_convolutional_modules.py
imports: from typing import Callable, Dict, List, Optional, Tuple, Union
  import pytest
  import torch
  from ludwig.modules.convolutional_modules import Conv1DLayer, Conv1DStack, Conv2DLayer, Conv2DLayerFixedPadding, Conv2DStack, ParallelConv1D, ParallelConv1DStack, ResNet, ResNetBlock, ResNetBlockLayer, ResNetBottleneckBlock
  from ludwig.utils.image_utils import get_img_output_shape
  from tests.integration_tests.parameter_update_utils import check_module_parameters_updated
label_desc: Use image node_id 1 for calling a global function with example usage: expected_seq_size(seq_size, padding, kernel_size, stride, dilation, pool_size, pool_padding, pool_stride) and returns: output_seq_size