vt::mean#

template<typename T = float, size_t N>
Tensor<T, 0> vt::mean(const Tensor<bool, N> &tensor)#

Returns the mean value of the tensor elements.

Template Parameters:
  • T – Data type of the result tensor. Default is float.

  • N – Number of dimensions of the tensor.

Parameters:

tensor – The tensor object.

Returns:

Tensor<T, 0>: The result tensor.

template<typename T, size_t N>
Tensor<T, 0> vt::mean(const Tensor<T, N> &tensor)#

Returns the mean value of the tensor elements.

Template Parameters:
  • T – Data type of the tensor.

  • N – Number of dimensions of the tensor.

Parameters:

tensor – The tensor object.

Returns:

Tensor<T, 0>: The result tensor.

template<typename T = float, size_t N>
Tensor<T, N - 1> vt::mean(const Tensor<bool, N> &tensor, int axis)#

Find the mean value of the tensor elements along the given axis. The current implementation is not optimized. The performance could improve if a reduce algorithm is applied along the axis.

Template Parameters:
  • T – Data type of the tensor. Default is float.

  • N – Number of dimensions of the tensor.

Parameters:
  • tensor – The tensor object.

  • axis – The axis to find the mean value.

Returns:

Tensor<T, N-1>: The result tensor.

template<typename T, size_t N>
Tensor<T, N - 1> vt::mean(const Tensor<T, N> &tensor, int axis)#

Find the mean value of the tensor elements along the given axis. The current implementation is not optimized. The performance could improve if a reduce algorithm is applied along the axis.

Template Parameters:
  • T – Data type of the tensor.

  • N – Number of dimensions of the tensor.

Parameters:
  • tensor – The tensor object.

  • axis – The axis to find the mean value.

Returns:

Tensor<T, N-1>: The result tensor.