Cost is the average of loss,right?
Here if i put sum as cost,the result is wrong, if i divided by m,the result passed.
Yes.
The line you highlighted is a sample to show you how to code, its not a complete code. See the line just after this.
hi @Di_Zhang
What course are you referring to?

