Thanks, i rewrote the code using tensored version and it is very fast as compared to the loopy one.
Now mymult(num1,num2) takes two tensors num1 and num2 which are then converted to numpy to perform unsupported operations and then return the result  Thanks a ton.