← COMP5511 全部讲次
Q06

Midterm 自拟练习|F 论文与 PyTorch

自拟练习 F 论文与 PyTorch:英文题干,逐题折叠中文解析、英文参考答案与回查页码。

手机上宽表格可左右滑动;自测答案默认收起,点击题目下方按钮查看。

使用边界:2026-11-04 课堂期中复习,非官方材料;考试安排按讲师通知整理,正式要求以讲师通知和课堂公告为准。主体覆盖 L01–L07、Tutorial 1–5 与 Assignment 1;通知列出的课件只到 Lecture 7,L08 放在第 08 节作范围存疑附节。练习题均为自拟,不是往年真题或预测卷。

复习资料:范围与搜索 · 概率与逻辑 · 机器学习与聚类 · 神经网络与 L08 附节

先做题再看解析:A 搜索 · B 概率 · C 逻辑 · D 机器学习 · E 聚类与神经网络 · F 论文与 PyTorch

怎么做:先只看题面,用英文作答,写出公式和每一步,再展开解析核对。解析里的数值都用 python 复算过;每题末尾给回查出处,页码为 PDF 页序。

F 论文与 PyTorch

F1 · Reading papers

Answer each part in one or two sentences.

(a) You find two papers on the same topic: one in a top conference and one on a preprint server. Which needs more checking, and why? (b) Which tool would you use to get the exact venue and BibTeX of a paper, and which one to search broadly? (c) Which section of a paper tells you what is broken or missing in current work? (d) Name the two common ways to propose a new method.

F1 · 查看答案与解析

答案:

(a) 预印本要多核实。顶会和期刊经过同行评审,预印本没有,结论和实验需要自己检查。

(b) DBLP 查准确出处和 BibTeX;Google Scholar 用来广泛搜索。

(c) Introduction,它说明现有工作哪里不行、缺了什么。

(d) 把别的领域的方法移植过来,或者改进现有方法。

English: (a) The preprint, because it has not been peer reviewed. (b) DBLP for the venue and BibTeX; Google Scholar for broad searching. (c) The Introduction. (d) Transfer an idea from another field, or improve an existing method.

易错点:等级和引用量只是线索,判断质量还要看评审状态和证据。

回查:T01 p.4–35。

F2 · Tensors and the training loop (no coding)

(a) Three tensors each have shape 2×3. Give the shape after concatenating them along dimension 0, after stacking them along dimension 0, and after concatenating them along dimension 1. (b) A = [[1, 2], [3, 4]] and B = [[0, 1], [1, 0]]. Compute A * B (element-wise) and A @ B (matrix product). (c) Put these training steps in the correct order: compute the loss; update the parameters; clear the gradients; backward pass; forward pass. (d) For Q = a³ − 4b with a = [1, 2] and b = [3, 5], the backward pass is called with an external gradient of ones. Give a.grad and b.grad. What are they if backward is run a second time without clearing?

F2 · 查看答案与解析

推理过程:cat 沿已有维度拼接,那一维相加;stack 新增一维,大小等于张量个数。

  • (a) cat dim 0:6×3;stack dim 0:3×2×3;cat dim 1:2×9
  • (b) A * B = [[0, 2], [3, 0]];A @ B = [[2, 1], [4, 3]]
  • (d) ∂Q/∂a = 3a² = [3, 12];∂Q/∂b = −4,即 [−4, −4]

答案:(a)(b) 见上。(c) clear the gradients → forward pass → compute the loss → backward pass → update the parameters。(d) a.grad = [3, 12],b.grad = [−4, −4];不清零再反向一次,梯度累加成 [6, 24] 和 [−8, −8]。

English: Gradients accumulate in .grad, so they must be cleared before each backward pass; otherwise the update uses the sum of old and new gradients.

易错点:stack 要求各张量形状相同;* 和 @ 在 2×2 上都能算,结果不同。

回查:T03 张量节、autograd 节、手写线性回归节。

F3 · Shapes in a small CNN

The input is 3×36×36 (channels × height × width). Layer 1: 8 filters 5×5, stride 1, no padding. Then 2×2 max pooling with stride 2. Layer 2: 16 filters 3×3, stride 1, no padding. Then 2×2 max pooling with stride 2. Then flatten and a fully connected layer with 10 outputs.

(a) Give the output shape after each layer. (b) Count the parameters of the two convolutional layers and the fully connected layer. (c) What is the shape of the weight matrix of the fully connected layer?

F3 · 查看答案与解析

推理过程:不补零、步长 1 时输出宽 = W − F + 1;2×2、步长 2 的池化宽高减半,深度不变。

层 输出形状 参数
卷积 1,8 个 5×5 8×32×32 (5×5×3 + 1) × 8 = 608
池化 8×16×16 0
卷积 2,16 个 3×3 16×14×14 (3×3×8 + 1) × 16 = 1168
池化 16×7×7 0
展平 784 0
全连接 10 784 × 10 + 10 = 7850

答案:(a)(b) 见表。(c) 权重矩阵形状为 (10, 784)。

English: Each filter spans the full input depth, so a 3×3 filter on 8 channels has 72 weights plus one bias. The fully connected layer stores its weights as (out_features, in_features).

易错点:第二层卷积的深度是 8,不是 3;全连接层的输入数要按池化后的 16×7×7 算。

回查:L07 p.31–44;T03 LeNet 节。

这组材料已读完,可以回课程页选择配套资料或练习:COMP5511 课程页。

个人整理的学习笔记,不是官方材料;数字与结论以课件和讲师为准。