jax.experimental.sparse.random_bcoo#
- jax.experimental.sparse.random_bcoo(key, shape, *, dtype=<class 'jax.numpy.float64'>, indices_dtype=None, nse=0.2, n_batch=0, n_dense=0, unique_indices=True, sorted_indices=False, generator=<function uniform>, **kwds)[源代码]#
生成一个随机 BCOO 矩阵。
- 参数:
key – 要传递给
generator函数的 PRNG 密钥。shape – 指定要生成的数组的形状的元组。
dtype – 要生成的数组的 dtype。
indices_dtype – BCOO 索引的 dtype。
nse – 矩阵中指定元素的数量,或者如果 0 < nse < 1,则为要指定的稀疏维度的分数(默认值:0.2)。
n_batch – 批处理维度的数量。必须满足
n_batch >= 0和n_batch + n_dense <= len(shape)。n_dense – 批处理维度的数量。必须满足
n_dense >= 0和n_batch + n_dense <= len(shape)。unique_indices – 指定索引是否唯一的布尔值(默认值:True)。
sorted_indices – 指定索引是否按字典顺序排序的布尔值(默认值:False)。
generator – 用于生成随机值的函数,接受一个密钥、形状和 dtype。它默认为
jax.random.uniform(),并且可以是任何具有类似签名的函数。**kwds – 传递给
generator的其他关键字参数。
- 返回:
一个具有指定属性的 sparse.BCOO 数组。
- 返回类型:
arr