class_docstr: Locally-connected layer for 1D inputs.
  
  The LocallyConnected1d layer applies a different set of filters to each patch
  of the input. This is similar to applying a convolution layer, except that
  locally-connected layer uses a different set of weights for each patch.
  
  The size of patch is determined by the kernel size. The stride is currently
  not modifiable and set to one. This means for the input of shape (..., L, D)
  the output shape for paddings 'SAME' and 'WRAP' will be (..., L, filters) and
  for padding 'VALID' (..., L-kernel_size+1, filters); where L is the number of
  "pixels" or "steps" in the input, D is the size of the embedding.
  
  Note that, since the weights for different patches are not shared, the number
  of "pixels" or "steps" cannot change after calling init_weights_and_state.
  This is because each "pixel" is assigned its own set of weights.
class_docstr_tok: ["Locally-connected","layer","for","1D","inputs",".","The","LocallyConnected1d","layer","applies","a","different","set","of","filters","to","each","patch","of","the","input",".","This","is","similar","to","applying","a","convolution","layer",",","except","that","locally-connected","layer","uses","a","different","set","of","weights","for","each","patch",".","The","size","of","patch","is","determined","by","the","kernel","size",".","The","stride","is","currently","not","modifiable","and","set","to","one",".","This","means","for","the","input","of","shape","(","...",",","L",",","D",")","the","output","shape","for","paddings","'SAME","'","and","'WRAP","'","will","be","(","...",",","L",",","filters",")","and","for","padding","'VALID","'","(","...",",","L-kernel_size+1",",","filters",")",";","where","L","is","the","number","of","''","pixels","''","or","``","steps","''","in","the","input",",","D","is","the","size","of","the","embedding",".","Note","that",",","since","the","weights","for","different","patches","are","not","shared",",","the","number","of","``","pixels","''","or","``","steps","''","can","not","change","after","calling","init_weights_and_state",".","This","is","because","each","``","pixel","''","is","assigned","its","own","set","of","weights","."]
docstr: Returns a locally-connected conv-like layer.
  
  Args:
    filters: Number of output filters in the convolution.
    kernel_size: A length of the convolution window. Must be an odd number.
    kernel_initializer: Function that creates a matrix of (random) initial
        connection weights `W` for the layer.
    bias_initializer: Function that creates a vector of (random) initial
        bias weights `b` for the layer.
    use_bias: If `True`, the layer uses a bias vector.
    padding: The type of padding to use; must be 'VALID', 'SAME', or 'WRAP'.
docstr_tok: ["Returns","a","locally-connected","conv-like","layer",".","Args",":","filters",":","Number","of","output","filters","in","the","convolution",".","kernel_size",":","A","length","of","the","convolution","window",".","Must","be","an","odd","number",".","kernel_initializer",":","Function","that","creates","a","matrix","of","(","random",")","initial","connection","weights","`","W","`","for","the","layer",".","bias_initializer",":","Function","that","creates","a","vector","of","(","random",")","initial","bias","weights","`","b","`","for","the","layer",".","use_bias",":","If","`","True","`",",","the","layer","uses","a","bias","vector",".","padding",":","The","type","of","padding","to","use",";","must","be","'VALID","'",",","'SAME","'",",","or","'WRAP","'","."]
code: def __init__(
      self,
      filters,
      kernel_size,
      kernel_initializer=init.GlorotUniformInitializer(),
      bias_initializer=init.RandomNormalInitializer(1e-6),
      use_bias=True,
      padding="VALID",
  ):
      """Returns a locally-connected conv-like layer.
  
      Args:
        filters: Number of output filters in the convolution.
        kernel_size: A length of the convolution window. Must be an odd number.
        kernel_initializer: Function that creates a matrix of (random) initial
            connection weights `W` for the layer.
        bias_initializer: Function that creates a vector of (random) initial
            bias weights `b` for the layer.
        use_bias: If `True`, the layer uses a bias vector.
        padding: The type of padding to use; must be 'VALID', 'SAME', or 'WRAP'.
      """
      super().__init__(
          name=f"LocallyConnected1d_{filters}_{kernel_size}"
      )
      self._filters = filters
      self._kernel_size = kernel_size
      assert self._kernel_size % 2 == 1  # kernel size has to be odd
      self._kernel_initializer = kernel_initializer
      self._bias_initializer = bias_initializer
      self._use_bias = use_bias
      self._padding = padding
  
imports: from absl import logging
  import numpy
  import tensorflow
  from trax import fastmath
  from trax.fastmath import numpy
  from trax.layers import base
  from trax.layers import initializers
  from trax.layers.assert_shape import assert_shape
  from trax.layers.base import Fn
label_desc: Use image node_id 1 to create a new LocallyConnected1d object from inherited base classes: base with example: obj = LocallyConnected1d(filters, kernel_size, kernel_initializer, bias_initializer, use_bias, padding)