Quiz-14 (2026.04.22) // 범위: ~07wk

Author

최규빈

Published

April 22, 2026

1. 다이어그램에 대응하는 네트워크 만들기

아래 각 노드 다이어그램에 대응하는 torch.nn.Sequential(...) 코드를 작성하시오.

(1) 입력 \({\bf X}\) 의 shape 은 \((n, 1)\), 출력 \(\hat{\bf Y}\) 의 shape 은 \((n, 1)\) 이다.

torch.nn.Sequential(
    torch.nn.Linear(in_features=1, out_features=5),
    torch.nn.ReLU(),
    torch.nn.Linear(in_features=5, out_features=1),
    torch.nn.Sigmoid()
)

대응하는 수식:

\[\underset{(n,1)}{\bf X} \overset{l_1}{\to} \underset{(n,5)}{\bf U^{(1)}} \overset{relu}{\to} \underset{(n,5)}{\bf V^{(1)}} \overset{l_2}{\to} \underset{(n,1)}{\bf U^{(2)}} \overset{sig}{\to} \underset{(n,1)}{\bf V^{(2)}} = \hat{\bf Y}\]

(2) 입력 \({\bf X}\) 의 shape 은 \((n, 2)\), 출력 \(\hat{\bf Y}\) 의 shape 은 \((n, 1)\) 이다.

torch.nn.Sequential(
    torch.nn.Linear(in_features=2, out_features=3),
    torch.nn.ReLU(),
    torch.nn.Linear(in_features=3, out_features=1),
)

대응하는 수식:

\[\underset{(n,2)}{\bf X} \overset{l_1}{\to} \underset{(n,3)}{\bf U^{(1)}} \overset{relu}{\to} \underset{(n,3)}{\bf V^{(1)}} \overset{l_2}{\to} \underset{(n,1)}{\bf U^{(2)}} = \hat{\bf Y}\]

(3) 입력 \({\bf X}\) 의 shape 은 \((n, 1)\), 출력 \(\hat{\bf Y}\) 의 shape 은 \((n, 1)\) 이다.

torch.nn.Sequential(
    torch.nn.Linear(in_features=1, out_features=2),
    torch.nn.ReLU(),
    torch.nn.Linear(in_features=2, out_features=5),
    torch.nn.ReLU(),
    torch.nn.Linear(in_features=5, out_features=1),
    torch.nn.Sigmoid()
)

대응하는 수식:

\[\underset{(n,1)}{\bf X} \overset{l_1}{\to} \underset{(n,2)}{\bf U^{(1)}} \overset{relu}{\to} \underset{(n,2)}{\bf V^{(1)}} \overset{l_2}{\to} \underset{(n,5)}{\bf U^{(2)}} \overset{relu}{\to} \underset{(n,5)}{\bf V^{(2)}} \overset{l_3}{\to} \underset{(n,1)}{\bf U^{(3)}} \overset{sig}{\to} \underset{(n,1)}{\bf V^{(3)}} = \hat{\bf Y}\]

2. 레이어/노드

1번에서 나온 세 네트워크 1-(1), 1-(2), 1-(3) 에 대해 각각의 은닉층 수각 은닉층의 노드 수를 적으시오.

  • 1-(1): 은닉층 1층, 노드 수 5
  • 1-(2): 은닉층 1층, 노드 수 3
  • 1-(3): 은닉층 2층, 노드 수는 각각 25