{
  "schema": "ml-prep/item@1",
  "item": {
    "id": "original-ml-convolution",
    "area": "machine-learning",
    "topic": "convolution",
    "origin": "original",
    "title": "Convolution output shape and parameters",
    "skills": [
      "output-shape",
      "padding-stride",
      "parameter-count"
    ],
    "priority": "core",
    "difficulty": "easy",
    "estimated_minutes": 6,
    "prerequisites": [
      "integer-arithmetic"
    ],
    "prompt": "An input has shape $32\\times32\\times3$. A convolution uses $16$ filters of size $5\\times5$, stride $2$, padding $2$, and one bias per filter. Compute the output shape and trainable parameter count.\n",
    "answer": "Each spatial dimension is\n\n$$\\left\\lfloor\\frac{32+2(2)-5}{2}\\right\\rfloor+1=16,$$\n\nso the output is $16\\times16\\times16$. The parameter count is\n\n$$5\\times5\\times3\\times16+16=1216.$$\n",
    "check": {
      "kind": "numeric",
      "id": "original-ml-convolution",
      "values": [
        16,
        16,
        16,
        1216
      ]
    }
  }
}