Homework Q4

How are supposed to compute ‖𝐴𝐡𝑖‖^2 with mxnet gluon vs. Python? Is (1) supposed to be with mxnet gluon and (2) with Python/NumPy?

Also, do you guys use for loops for (1)? It takes me an insanely long time and kills my kernel,

Check section 2.1.6. Mutual Transformation of NDArray and NumPy.

It only took me less than 30s to run on CPU.

now I feel like I must be doing something wrong…
mine only took 0.5s on CPU

It probably takes so long if you convert everything to NumPy / Python one variable at a time. Stay in Gluon land as long as possible.