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 >= 0n_batch + n_dense <= len(shape)

  • n_dense – 批处理维度的数量。 必须满足 n_dense >= 0n_batch + n_dense <= len(shape)

  • unique_indices – 布尔值,指定索引是否应唯一(默认值:True)。

  • sorted_indices – 布尔值,指定索引是否应按字典顺序按行排序(默认值:False)。

  • generator – 用于生成随机值的函数,接受键、形状和 dtype。 默认为 jax.random.uniform(),并且可以是具有类似签名的任何函数。

  • **kwds – 传递给 generator 的其他关键字参数。

返回:

具有指定属性的 sparse.BCOO 数组。

返回类型:

arr