本文整理汇总了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