calculate_density

paddle.incubate.asp. calculate_density ( x ) [source]

Return the density of the input tensor.

Parameters

x (nparray) – The input tensor.

Returns

float, The density of x.

Examples

>>> import paddle
>>> import numpy as np

>>> x = np.array([[0, 1, 3, 0],
...             [1, 1, 0, 1]])
>>> out = paddle.incubate.asp.calculate_density(x)
>>> print(out)
0.625