def _conv_general_param_type_converter(window_strides, lhs_dilation,
                                       rhs_dilation, dim):
  """Convert strides, lhs_dilation, rhs_dilation to match TF convention.

  For example,
   in the 3D case, if lhs_dilation = 2, then convert it to [2, 2, 2]
                   if lhs_dilation = (2, 2, 2), convert it also to [2, 2, 2]

  Args:
    window_strides: window_strides to be converted
    lhs_dilation: lhs_dilation to be converted
    rhs_dilation: rhs_dilation to be converted
    dim: dim to be converted

  Returns:
    The updated window_strides, lhs_dilation and rhs_dilation
  """
  def _as_list_of_size(item, size):
    if item is None:
      return None
    return [item] * size if isinstance(item, int) else list(item)
  return (_as_list_of_size(window_strides, dim),
          _as_list_of_size(lhs_dilation, dim),
          _as_list_of_size(rhs_dilation, dim))
Convert strides, lhs_dilation, rhs_dilation to match TF convention.

  For example,
   in the 3D case, if lhs_dilation = 2, then convert it to [2, 2, 2]
                   if lhs_dilation = (2, 2, 2), convert it also to [2, 2, 2]

  Args:
    window_strides: window_strides to be converted
    lhs_dilation: lhs_dilation to be converted
    rhs_dilation: rhs_dilation to be converted
    dim: dim to be converted

  Returns:
    The updated window_strides, lhs_dilation and rhs_dilation
  
trax/tf_numpy/extensions/extensions.py