Back to questions
JuniorTheoryCommon
What does this program print?
import numpy as np
x = np.array([1.0, 2.0])
W = np.array([[1.0, -2.0], [1.0, 0.5]])
b = np.array([0.5, 0.5])
h = np.maximum(0, x @ W + b)
print(h[0], h[1])3.5 0.0
- Expecting
3.5 -0.5: ReLU replaces every negative sum with zero, so the second neuron's-0.5becomes0.0. - Expecting
0.0 2.5: inx @ Weach column ofWholds one neuron's weights, so the first neuron is1 * 1 + 2 * 1 + 0.5 = 3.5.
- What would the program print if ReLU were replaced by the sigmoid?
- Why does stacking layers without any activation give nothing a single linear layer lacks?