Question: Problem 1 [ 4 points ] Consider the following code snippet to define a neural network in PyTorch: ` ` ` claan MyNetwork ( nn

Problem 1[4 points]
Consider the following code snippet to define a neural network in PyTorch:
```
claan MyNetwork(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
A Bollerplate not shown
self.ll = nn.Linear(input_size, hidden_size)
self.nonlin - nn.Tanh()
self.12= nn.Linear(hidden_size, output_size)
self.log_sm = nn.LogSoftmax(dim=0)
# Initialization, etc. not shown
def forward(self, x):
return self.log_sm(self,nonlin(self.12(self,nonlin(self.11(x)))))
```
1.1[2 points] Let b be a batch size >1. Which of the following tensor shapes can be input to this network without causing a code crash?
I. [inp]
II.[b, inp]
III. [ing, b]
A.1
B. I and II
C. I and III
D. II and III
E. I, II, and III
1.2[2 points] What is "wrong" with the above network compared to standard neural network models?
A. Tanh is not differentiable so backpropagation will not work
B. There is a dimension mismatch which will lead to a crash
C. Reusing the self.nonlin layer will cause a crash
D. The presence of the nonlinearity before the softmax results in a non-standard model
Problem 1 [ 4 points ] Consider the following

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!