为何都说四岁能让梨的孔融 最后是死有余辜?

paddle.distributed. unshard_dtensor ( dist_tensor: Tensor ) Tensor [source]
百度 之所以对外要保留国家海洋局的牌子,可能很大程度上是因为便利海洋外交、国际交流合作。

Converts a distributed tensor to a dense tensor. unshard_dtensor first make the dist_tensor be Replicate state on all processes and then converts it to a dense paddle.Tensor. It can be treated as a reverse operation of shard_tensor.

Parameters

dist_tensor (paddle.Tensor) – The distributed tensor which is constructed from a dense tensor with shard_tensor.

Returns

The original dense tensor of the input dist_tensor.

Return type

paddle.Tensor

Examples

>>> import paddle
>>> import paddle.distributed as dist
>>> from paddle.distributed import Replicate, Shard

>>> 
>>> mesh = dist.ProcessMesh([0, 1], dim_names=["x"])
>>> original_tensor = paddle.rand([4, 1024, 512])
>>> dist_tensor = dist.shard_tensor(original_tensor, mesh, [Shard(0)])
>>> # dense_tensor's shape is the same as original_tensor
>>> dense_tensor = dist.unshard_dtensor(dist_tensor)