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)[source]#
產生隨機 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