本文整理匯總了Python中distarray.local.localarray.LocalArray.ndarray[:]方法的典型用法代碼示例。如果您正苦於以下問題:Python LocalArray.ndarray[:]方法的具體用法?Python LocalArray.ndarray[:]怎麽用?Python LocalArray.ndarray[:]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類distarray.local.localarray.LocalArray
的用法示例。
在下文中一共展示了LocalArray.ndarray[:]方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: randn
# 需要導入模塊: from distarray.local.localarray import LocalArray [as 別名]
# 或者: from distarray.local.localarray.LocalArray import ndarray[:] [as 別名]
def randn(distribution=None):
if distribution is None:
return np.random.randn()
else:
dtype = np.random.randn(1).dtype
la = LocalArray(distribution, dtype=dtype)
la.ndarray[:] = np.random.randn(*la.local_shape)
return la
示例2: normal
# 需要導入模塊: from distarray.local.localarray import LocalArray [as 別名]
# 或者: from distarray.local.localarray.LocalArray import ndarray[:] [as 別名]
def normal(loc=0.0, scale=1.0, distribution=None):
if distribution is None:
return np.random.normal(loc, scale)
else:
dtype = np.random.normal(loc, scale, size=1).dtype
la = LocalArray(distribution, dtype=dtype)
la.ndarray[:] = np.random.normal(loc, scale, size=la.local_shape)
return la
示例3: randint
# 需要導入模塊: from distarray.local.localarray import LocalArray [as 別名]
# 或者: from distarray.local.localarray.LocalArray import ndarray[:] [as 別名]
def randint(low, high=None, distribution=None):
if distribution is None:
return np.random.randint(low, high)
else:
dtype = np.random.randint(low, high, size=1).dtype
la = LocalArray(distribution, dtype=dtype)
la.ndarray[:] = np.random.randint(low, high, size=la.local_shape)
return la
示例4: beta
# 需要導入模塊: from distarray.local.localarray import LocalArray [as 別名]
# 或者: from distarray.local.localarray.LocalArray import ndarray[:] [as 別名]
def beta(a, b, distribution=None):
if distribution is None:
return np.random.beta(a, b)
else:
dtype = np.random.beta(a, b, size=1).dtype
la = LocalArray(distribution, dtype=dtype)
la.ndarray[:] = np.random.beta(a, b, size=la.local_shape)
return la