Tensorflow의 Dataset 사용법 정리

MinMaxScaler와 같이 사용할 때 마다 까먹는 Tensorflow의 Dataset사용법 정리!!
모델 학습을 위한 Dataset을 만들때 사용하는 Tensorflow의 Dataset기능 중 가장 자주 사용하는 용어에 대해 정리해볼 생각이다.

MinMaxScaler와 같이 사용할 때 마다 까먹는 Tensorflow의 Dataset사용법 정리!!
모델 학습을 위한 Dataset을 만들때 사용하는 Tensorflow의 Dataset기능 중 가장 자주 사용하는 용어에 대해 정리해볼 생각이다.

cuDNN이 꼭 필요할까? 응. 필요하다.
Added September 2026: This post was written in 2023 and reflects the tools and library versions available at that time. Installation steps, APIs, and version numbers may have changed since.

LSTM input_shape의 (time_step, features) 의미와 batch_input_shape, 그리고 “Incompatible shapes” 에러가 왜 나는지 정리. 2026년에 Keras 3로 다시 돌려본 결과 포함.
Corrected September 2026: An earlier version said the data size must always be divisible by the batch size. That is only true for a stateful LSTM (
stateful=True); a normal LSTM trains fine with a smaller last batch. The post now includes a re-run on TensorFlow 2.21 / Keras 3.15, wherebatch_input_shapehas been replaced bykeras.Input(batch_shape=...).

잊기전에 적어두자 Conda 사용법!
2026-11-16 갱신: macOS 27.0.1 arm64의 Miniconda(conda 25.11.1)에서 임시 환경 생성·활성화·조회·삭제를 확인했다. 원문의 환경 목록 명령을 고치고 실행 결과를 붙였다.

torch.cuda.is_available()가 False이거나 “no kernel image is available” 에러가 날 때 확인할 것. 대부분 CPU 전용 torch가 깔렸거나 GPU에 맞지 않는 빌드다. 세 줄로 확인하는 코드 포함.
Corrected October 2026: The original list of causes was misleading. PyTorch’s pip and conda builds ship their own CUDA runtime, so the system CUDA Toolkit (
nvcc) version does not need to match. “No kernel image” means the installed PyTorch build was not compiled for your GPU’s architecture. PyTorch also stopped publishing to the-c pytorchconda channel after 2.5. A diagnostic script, tested with PyTorch 2.14.1, was added at the end.

RNN이 뭔지, 왜 활성화 함수로 relu 대신 tanh를 쓰는지 정리한 노트. relu와 tanh를 50번 반복해 본 작은 실험 포함.
Corrected September 2026: An earlier version called ReLU a linear function. ReLU is non-linear; the real problem is that it has no upper bound, so repeated steps can blow up. A small NumPy experiment now shows this, and an unfinished list item was removed.

TensorFlow가 뭔지, 추천 시스템 쪽에서는 뭘 쓸 수 있는지 짧게 적어둔 메모. PyTorch와의 차이도 한 줄씩.
Corrected September 2026: Removed a long pasted section that was left in by mistake and fixed a few facts: TensorFlow 2 runs eagerly by default (graphs are optional via
tf.function), Keras was already part of TensorFlow before 2.0, and TFX is a production pipeline tool rather than a recommender library.