PyTorch is the framework most research and an increasing share of production runs on.
Its basic object is the tensor, an array of numbers that can sit on a GPU.
Tensors behave much like NumPy arrays, with the same slicing and broadcasting.
Moving one onto the device with a single call is what buys the parallel hardware.
Autograd records every operation performed on a tensor that requires gradients.
That record is a graph, built fresh on each forward pass and thrown away after the backward one.
Building it on the fly is what makes ordinary control flow work inside a model.
You can put an if statement in a model and it simply behaves as written.
Models are classes holding layers, with a forward method describing the computation.
The training loop is yours to write: zero the gradients, forward, loss, backward, step.
Forgetting to zero the gradients makes them accumulate, which is a rite of passage bug.
Because the loop is explicit you can print or break anywhere inside it.
That debuggability is most of why it won research against the graph-first frameworks.
The ecosystem around it matters as much as the library, from Hugging Face to Lightning.
TensorFlow remains capable and deployed, but new work overwhelmingly starts here.