The existing line
for (i in nrow(x))
causes the for loop to execute once and the value of i will be the number of rows in x.
Similarly, the second for loop will execute once and j will be the number of columns in x.
This line
x[i, j] < max(x[i, j], 0)
will execute once and will modify the last row and last column of x.
The naive_relu and pmax functions should return the same thing which I tested like this
set.seed(1)
mxy = matrix(runif(9)0.5,3,3)
naive_relu(mxy)
pmax(mxy,0)
I had to make sure some of the values where less than 0 to show the max function working correctly.
