Learn Before
Code
Programmatic L2 Norm Calculation
The norm of a vector can be calculated programmatically using linear algebra utilities in modern deep learning frameworks. In PyTorch and TensorFlow, this is accomplished by passing the vector to torch.norm(u) and tf.norm(u), respectively. In JAX and NumPy (used by MXNet), it is computed using the linear algebra module via jnp.linalg.norm(u) and np.linalg.norm(u).
0
1
Updated 2026-05-02
Tags
D2L
Dive into Deep Learning @ D2L