code: def conv1d_unstrided(
      input,
      filters,
      image_shape,
      filter_shape,
      border_mode="valid",
      subsample=(1,),
      filter_flip=True,
      implementation=conv1d_sc,
  ):
      """
      perform a strided 1D convolution by reshaping input and filters so that the
      stride becomes 1. This function requires that the filter length is a
      multiple of the stride. It also truncates the input to have a length
      that is a multiple of the stride.
      """
      batch_size, num_input_channels, input_length = image_shape
      num_filters, num_input_channels_, filter_length = filter_shape
      stride = subsample[0]
  
      if filter_length % stride > 0:
          raise RuntimeError(
              "Filter length (%d) is not a multiple of the "
              "stride (%d)" % (filter_length, stride)
          )
      # TODO: test if this works for border_mode='full'
      if border_mode not in ("valid", 0, (0,)):
          raise RuntimeError(
              "Unsupported border_mode for conv1d_unstrided: "
              "%s" % border_mode
          )
  
      num_steps = filter_length // stride
  
      # input sizes need to be multiples of the strides,
      # truncate to correct sizes.
      truncated_length = (input_length // stride) * stride
      input_truncated = input[:, :, :truncated_length]
  
      r_input_shape = (
          batch_size,
          num_input_channels,
          truncated_length // stride,
          stride,
      )
      r_input = input_truncated.reshape(r_input_shape)
  
      # fold strides into the feature maps dimension (input)
      r_input_folded_shape = (
          batch_size,
          num_input_channels * stride,
          truncated_length // stride,
      )
      r_input_folded = r_input.dimshuffle(0, 1, 3, 2).reshape(
          r_input_folded_shape
      )
  
      r_filter_shape = (
          num_filters,
          num_input_channels,
          num_steps,
          stride,
      )
      r_filters_flipped = filters[:, :, ::-1].reshape(r_filter_shape)
  
      # fold strides into the feature maps dimension (filters)
      r_filter_folded_shape = (
          num_filters,
          num_input_channels * stride,
          num_steps,
      )
      r_filters_flipped_folded = r_filters_flipped.dimshuffle(
          0, 1, 3, 2
      ).reshape(r_filter_folded_shape)
      r_filters_folded = r_filters_flipped_folded[:, :, ::-1]  # unflip
  
      return implementation(
          r_input_folded,
          r_filters_folded,
          r_input_folded_shape,
          r_filter_folded_shape,
          border_mode,
          subsample=(1,),
          filter_flip=filter_flip,
      )
  
file_path: Lasagne/lasagne/theano_extensions/conv.py
imports: import numpy
  import theano.tensor
  from ..utils import int_types
label_desc: Use image node_id 4 for calling a global function with example usage: conv1d_unstrided(input, filters, image_shape, filter_shape, border_mode, subsample, filter_flip, implementation) and returns: implementation