Calculation of Angles between features

Hi,
Can any one help to provide Pytorch implementation of eq. 3,4,5 given in the following pic. Here, Ci is the center of class and I believe it could be calculated by taking the mean of class. Could anyone also shed light on the statement in the paper i.e. the dimension of ci (center of class i) and fik (kth sample of feature of class i) are same, its a bit confusing to me.