Hi,
This is unfortunately the expected output yes.
Since log is not defined on the negative side, the gradient it generates can be anything. The choice is made to make the op as fast as possible.
To make the gradients 0 you can simply make sure that you never pass an invalid input to log.
In this case by doing log(x[1]) but in general check entries for x>0 before passing them to log.