모든 loss function이 만들어지는 원자들
대부분 TF math는 원소별 작동해 — scalar 함수를 각 원소에 독립적으로 적용. 더하기, 빼기, 곱하기, 나누기, square, sqrt, exp, log, sin, sigmoid, tanh, ReLU. 이게 loss function이랑 activation이 만들어지는 원자들이야.
Reduction은 하나 이상의 axis를 축소해. tf.reduce_sum, tf.reduce_mean, tf.reduce_max, tf.reduce_min이 전역 (scalar 반환) 또는 지정 axis로 작동. keepdims=True 옵션은 축소된 차원을 size 1로 유지 — 원래 shape로 broadcast back할 때 핵심.
tf.argmax, tf.argmin은 max/min 원소의 index 반환 — classification에서 logit으로부터 예측 class 찾는 용도.
이게 왜 중요하냐면: MSE는
tf.reduce_mean(tf.square(y_true - y_pred)). cross-entropy는 tf.math.log + tf.reduce_sum. accuracy는 tf.argmax + tf.equal + tf.reduce_mean(tf.cast(...)). 이 원자들이 보이면 어떤 loss function도 읽을 수 있어.