Please see the screenshot below
                    
            
           28


or you can see the pastebin here
https://pastebin.com/BFnLXveJ 23
The related code is at line 31 and 32.
since x_train is (3, 16, 16 )
and x_test is (10, 3, 16, 16 )
I need to reshape it to be (1, 3, 16, 16 ) such that broadcasting will be performed at the first dimension which is the number of observation.
Did I get this correct? Thank you.
 for train in range(num_train):
    dists[train]=((x_train[train].reshape(-1,C,H,W) - x_test)**2).sum().sqrt()