mindspore.ops.mvlgamma
- mindspore.ops.mvlgamma(input, p)[source]
Returns the results of the multivariate log-gamma function with dimension p element-wise.
The mathematical calculation process of Mvlgamma is shown as follows:
\[\log (\Gamma_{p}(input))=C+\sum_{i=1}^{p} \log (\Gamma(input-\frac{i-1}{2}))\]where \(C = \log(\pi) \times \frac{p(p-1)}{4}\) and \(\Gamma(\cdot)\) is the Gamma function.
- Parameters
input (Tensor) – The input tensor of the multivariate log-gamma function, which must be one of the following types: float32, float64. The shape is \((N,*)\), where \(*\) means any number of additional dimensions. And the value of any element in input must be greater than \((p - 1) / 2\).
p (int) – The number of dimensions. And the value of p must be greater than or equal to 1.
- Returns
Tensor, has the same shape and type as input.
- Raises
TypeError – If dtype of input is neither float32 nor float64.
TypeError – If p is not an int.
ValueError – If p is less than 1.
ValueError – If not all elements of input are greater than \((p - 1) / 2\).
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> x = Tensor(np.array([[3, 4, 5], [4, 2, 6]]), mindspore.float32) >>> y = ops.mvlgamma(x, p=3) >>> print(y) [[2.694925 5.402975 9.140645] [5.402975 1.596312 13.64045]]