Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Tensorflow

CPU만 사용하도록 설정

Tensor

Ranks

텐서 형상 조정

NumPy.ndarray와 TensorFlow.Tensor

산술 연산

차원 조정

TensorFlow 변수(variable)

경사 산출

f(x)=x2→∂f∂x=2xf(x) = x^2 \rightarrow \frac{\partial f}{\partial x}=2x
p(t)=4.9t2p(t) = 4.9t ^ 2
v(t)=9.8tv(t) = 9.8t
a=9.8a = 9.8

tf.Variable 과 최적화(optimizer)

실행 방식

  1. 즉시 실행 (Eager Execution)

  2. 그래프 실행 (Graph Execution)

그래프 함수(tf.function)는 호출하는 모든 하위 함수에 적용된다.

즉시 실행과 그래프 실행 실행 속도 비교

그래프 실행은 간단한 작은 연산들이 많은 경우, 실행 속도 향상에 도움이 될 수 있다.

합성곱 (convolution) 연산처럼 각 연산의 비용이 높지만 연산의 개수 자체가 적은 경우는 그래프 실행으로 연산 속도가 크게 개선되지 않을 수 있다.

MLP 구현