Question: twodigit / train _ utils.py in this problom In your projoct foldor, look as the part 2 - twodigit subtoldcr. Thcre you can find the

twodigit/train_utils.py in this problom
In your projoct foldor, look as the part2-twodigit subtoldcr. Thcre you can find the filcs
mip.py and
conv.py.
Your main task hore is to complcse the code irside the method sain in these files
Do the folowing stcps:
Look at maLn method in coch file Idcontify the training and test data and labcle. How many images are inside
the train and test data? What is the sizc of cach imagc?
Look at the defirition of the MLP clacs in
mip.py. Try to make scrac of what thoac lines are trying in
achicve. What is y_train[a] and y_train[1]?
Look at train
utils.py, particularly the run epoch function.
Now ghen the intuition you have bult wi:h the above stopa, complete the following tasks.
Fully connected network
0 points puasale fungrietual
This problom is nequincd but ungraded bccouse it taloes a lot of ncsources from the graders. Honcec plewse try
your best, subvit your code but do nat wovy if the grador docs not refum, and refor to the solutians after due
datc.
Complete the code main in
mip.py to buid a fuly-connocted model with a single hidden Izycr with E4 units.
For this, you nood to malos use of Linear loyora in PyTorch; Unifes in the provious single-digt case, hore you
nood in use two scparatc Incar output Isyers, in generate the two outputs (corresponding to the first and
sccond digits).
Notc that we have prowided you with an implementation of rlatten , which maps a higher dimensional terant
into an N xd onc, where N is the rumbcr of ssmplcs in your batch and d is the length of the flattonod
dimension of your tensor is Nhw, the flattencd dmenaion is d-{h*w}|.
Available Functions: Yau heve access to the tarch_m modulc as mn , to the tarch_m_tunctianal as r
and to the rlatten layce as rlatten ; No nocd to import arything.a inport torct
4 inpart torct \an an ct
A part_ra_cata_aL +'../a
18
13 batat_siae - b=
12 ro claccos -2e
13Prcss ESC then TAB or click outside of the code cditcr to exdt.
Incarract
Test resultsTraceback {most recent cala Lant}: tren part2 twadigat_train utadx inport latckity data, r-n opoch, train madeL, flatter
NaduleMat TrurdZrrar: Na madule named 'part2 twaddRat'
 twodigit/train_utils.py in this problom In your projoct foldor, look as the

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 Databases Questions!