title: What is the difference between conv1d with kernel_size=1 and dense layer?
body: <p>I am building a CNN with Conv1D layers, and it trains pretty well. I'm now looking into how to reduce the number of features before feeding it into a Dense layer at the end of the model, so I've been reducing the size of the Dense layer, but then I came across <a href="https://machinelearningmastery.com/introduction-to-1x1-convolutions-to-reduce-the-complexity-of-convolutional-neural-networks/" rel="noreferrer">this article</a>. The article talks about the effect of using a Conv2D filters with a kernel_size=(1,1) to reduce the number of features. </p>
  
  <p>I was wondering what the difference is between using a Conv2D layer with kernel_size=(1,1) <code>tf.keras.layers.Conv2D(filters=n,kernel_size=(1,1))</code> and using a Dense layer of the same size <code>tf.keras.layers.Dense(units=n)</code>? From my perspective (I'm relatively new to neural nets), a filter with kernel_size=(1,1) is a single number, which is essentially equivalent to weight in a Dense layer, and both layers have biases, so are they equivalent, or am I misunderstanding something? And if my understanding is correct, in my case where I am using Conv1D layers, not Conv2D layers, does that change anything? As in is <code>tf.keras.layers.Conv1D(filters=n, kernel_size=1)</code> equivalent to <code>tf.keras.layers.Dense(units=n)</code>?</p>
  
  <p>Please let me know if you need anything from me to clarify the question. I'm mostly curious about if Conv1D layers with kernel_size=1 and Conv2D layers with kernel_size=(1,1) behave differently than Dense layers.</p>