Question:

The figure below shows a one-dimensional function, \( f \), and a filter \( w \). Consider \( f \) is padded with zeros on both sides. Which one among the following will be the final convolution output of \( f \) with \( w \) after the padding zeros are removed from the output?  \[ f = [0 \quad 0 \quad 1 \quad 0 \quad 0], \quad w = [1 \quad 2 \quad 3] \]

Show Hint

In 1D convolution with padding, always flip the filter before applying, and remove padded output values after convolution to get the final result.
Updated On: Apr 17, 2025
  • \([0 \quad 0 \quad 1 \quad 0 \quad 0]\)
  • \([3 \quad 2 \quad 1 \quad 0 \quad 0]\)
  • \([0 \quad 0 \quad 1 \quad 2 \quad 3]\)
  • \([1 \quad 2 \quad 3 \quad 0 \quad 0]\)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

The convolution of a 1D function \( f \) with a filter \( w \) (with zero-padding) is calculated by flipping the kernel \( w \) and sliding it across the zero-padded input \( f \).
Step-by-step:
Given:
\[ f = [0 \quad 0 \quad 1 \quad 0 \quad 0] \quad {(with zero-padding already included)} \] \[ w = [1 \quad 2 \quad 3] \quad \Rightarrow \quad {flipped } w = [3 \quad 2 \quad 1] \] Now compute the convolution:

Position 1: \( [0,0,0] \cdot [3,2,1] = 0 \)
Position 2: \( [0,0,1] \cdot [3,2,1] = 1 \)
Position 3: \( [0,1,0] \cdot [3,2,1] = 2 \)
Position 4: \( [1,0,0] \cdot [3,2,1] = 3 \)
Position 5: \( [0,0,0] \cdot [3,2,1] = 0 \)

So the full convolution result is:
\[ [0 \quad 0 \quad 1 \quad 2 \quad 3 \quad 0 \quad 0] \] Now remove the padded outputs from the beginning and end (one on each side), final result:
\[ \boxed{[0 \quad 0 \quad 1 \quad 2 \quad 3]} \] Final Answer: (C)

Was this answer helpful?
0
0

Top Questions on General Science

View More Questions

Questions Asked in GATE GE exam

View More Questions