How exp(-z) is working in a sigmoid function in neural networks while z is a matrix?
In many languages and libraries, operations that apply to a scalar can be applied to vectors, matrices and tensors. They're just applied element-wise, and the result is another vector, matrix, etc with each value transformed by that function.