本文整理匯總了Python中distarray.local.localarray.LocalArray.from_distarray方法的典型用法代碼示例。如果您正苦於以下問題:Python LocalArray.from_distarray方法的具體用法?Python LocalArray.from_distarray怎麽用?Python LocalArray.from_distarray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類distarray.local.localarray.LocalArray
的用法示例。
在下文中一共展示了LocalArray.from_distarray方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_values
# 需要導入模塊: from distarray.local.localarray import LocalArray [as 別名]
# 或者: from distarray.local.localarray.LocalArray import from_distarray [as 別名]
def test_values(self):
if self.comm.Get_rank() == 0:
assert_array_equal(np.arange(20), self.larr.ndarray)
elif self.comm.Get_rank() == 1:
assert_array_equal(np.arange(30), self.larr.ndarray)
larr = LocalArray.from_distarray(self.larr, comm=self.comm)
if self.comm.Get_rank() == 0:
assert_array_equal(np.arange(20), larr.ndarray)
elif self.comm.Get_rank() == 1:
assert_array_equal(np.arange(30), larr.ndarray)
示例2: test_round_trip_elements
# 需要導入模塊: from distarray.local.localarray import LocalArray [as 別名]
# 或者: from distarray.local.localarray.LocalArray import from_distarray [as 別名]
def test_round_trip_elements(self):
larr = LocalArray.from_distarray(self.larr, comm=self.comm)
if self.comm.Get_rank() == 0:
idx = (0,) * larr.ndarray.ndim
larr.ndarray[idx] = 99
assert_array_equal(larr.ndarray, self.larr.ndarray)
示例3: test_round_trip_equality_from_dict
# 需要導入模塊: from distarray.local.localarray import LocalArray [as 別名]
# 或者: from distarray.local.localarray.LocalArray import from_distarray [as 別名]
def test_round_trip_equality_from_dict(self):
larr = LocalArray.from_distarray(self.larr.__distarray__(),
comm=self.comm)
self.assert_round_trip_equality(larr)
示例4: test_round_trip_equality_from_object
# 需要導入模塊: from distarray.local.localarray import LocalArray [as 別名]
# 或者: from distarray.local.localarray.LocalArray import from_distarray [as 別名]
def test_round_trip_equality_from_object(self):
larr = LocalArray.from_distarray(comm=self.comm, obj=self.larr)
self.assert_round_trip_equality(larr)