clumsygrad.math

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.

clumsygrad.math.abs(tensor: Tensor) Tensor[source]#

Compute the absolute value of the tensor.

clumsygrad.math.sqrt(tensor: Tensor) Tensor[source]#

Compute the square root of the tensor.

clumsygrad.math.exp(tensor: Tensor) Tensor[source]#

Compute the exponential of the tensor.

clumsygrad.math.log(tensor: Tensor) Tensor[source]#

Compute the natural logarithm of the tensor.

clumsygrad.math.sin(tensor: Tensor) Tensor[source]#

Compute the sine of the tensor.

clumsygrad.math.cos(tensor: Tensor) Tensor[source]#

Compute cosine of tensor.

clumsygrad.math.tan(tensor: Tensor) Tensor[source]#

Compute tangent of tensor.