import numpy as np def relu(x): return np.maximum(x, 0) def relu_prime(x): return np.where(x > 0, 1, 0) def tanh(x): return np.tanh(x) def tanh_prime(x): return 1 - np.tanh(x) ** 2 def sigmoid(x): return 1.0 / (1.0 + np.exp(-x)) def sigmoid_prime(x): s = sigmoid(x) return s / 1.0 - s