LLM Learning Hub

workspace/llm-course/home

NumPy

NumPy is Python's foundational library for numerical computing, providing fast n-dimensional arrays (ndarray) and vectorized math operations. It is the backbone of nearly all scientific Python packages.

What is NumPy?

NumPy is Python's foundational library for numerical computing, providing fast n-dimensional arrays (ndarray) and vectorized math operations. It is the backbone of nearly all scientific Python packages.

NumPy is Python's foundational library for numerical computing, providing fast n-dimensional arrays (ndarray) and vectorized math operations. It is the backbone of nearly all scientific Python packages.

Where is it used?

NumPy arrays underlie PyTorch tensor operations on CPU and are used for data preprocessing, tokenized dataset manipulation, and feature engineering across every ML pipeline.

How to build it

Install with `pip install numpy`, create an array with `np.array([[1,2],[3,4]])`, and practice broadcasting by adding a 1D array to a 2D array to understand shape rules.

Code

A practical example:

example.pypython