Why create a copy of z before calculating Relu?

Be careful: the output is the same, but without the copy you have modified the original z value that was passed in as an argument. Here’s a thread from the DLS forums that explains why that copy is necessary. Not sure you’ll be able to see it if you are only signed up for NLP.

In case you can’t read that thread, the point is that saying this:

result = z

does not “copy” anything. After that statement result and z are both python object references that point at the same object in memory. If you then modify the contents of result, it also modifies the contents of z. That is why the copy is necessary here.