How to use a numpy function as the loss function without getting errors during run time?

Thanks for the link, but isn’t this breaking the graph? I ask you because I read this Calculating loss with numpy function.