Learn Before
Code
Programmatic Tensor Summation
In deep learning frameworks, the default summation function reduces a tensor along all of its axes, ultimately producing a single scalar value that represents the total sum of its elements. For example, in PyTorch, MXNet, and JAX, this is executed using the .sum() method on the tensor object (e.g., x.sum()), whereas TensorFlow provides the explicit tf.reduce_sum() function.
0
1
Updated 2026-05-02
Tags
D2L
Dive into Deep Learning @ D2L