3.1.3. clumsygrad.math#
This module provides basic mathematical operations.
- clumsygrad.math.sum(tensor: Tensor, axis=None, keepdims=False) Tensor[source]#
Compute the sum of the tensor along specified axis.
- Parameters:
tensor – The input Tensor to compute the sum of.
axis – Axis or axes along which the sum is computed. Default is None, which computes the sum of the flattened array.
keepdims – If True, the reduced axes are left in the result as dimensions with size one.
- Returns:
A new Tensor containing the sum of the input tensor.
- clumsygrad.math.mean(tensor: Tensor, axis=None, keepdims=False) Tensor[source]#
Compute the mean of the tensor along specified axis.
- Parameters:
tensor – The input Tensor to compute the mean of.
axis – Axis or axes along which the means are computed. Default is None, which computes the mean of the flattened array.
keepdims – If True, the reduced axes are left in the result as dimensions with size one.
- Returns:
A new Tensor containing the mean of the input tensor.