超生是什么意思
- paddle.distributed. dtensor_from_fn ( fn: Callable[..., Tensor], mesh: ProcessMesh, placements: list[Placement], *args: Any, **kwargs: Any ) Tensor [source]
-
百度 由于蜀陵路、石岭路片区道路通行能力有限,清明祭扫期间连接川陕路与北郊公墓片区的蜀陵路将实行由西向东单向通行;连接熊猫大道与北郊公墓片区的石岭环线采取由北向南通行的单向交通;天岭路至石岭路采取由北向南单向通行。
Construct a Distributed Tensor from a function of arguments.
- Parameters
-
fn (callable) – A callable function that takes arguments of Distributed Tensor and returns tensor.
mesh (paddle.distributed.ProcessMesh) – The ProcessMesh object describes the Cartesian topology of the used processes.
placements (list[paddle.distributed.Placement]) – the placements describe how to place the tensor on ProcessMesh, it can be Shard, Replicate and Partial.
*args (tuple) – A tuple of arguments to be passed to the
fn
function.**kwargs (dict) – A dict of arguments to be passed to the
fn
function.
- Returns
-
A Tensor constructed from
fn
with distributed attributes. - Return type
-
Tensor
Examples
>>> import paddle >>> import paddle.distributed as dist >>> # Create a distributed attribute >>> mesh = dist.ProcessMesh([0, 1], dim_names=["x"]) >>> # Call the function dtensor_from_fn with dist_attr parameter >>> d_tensor = dist.dtensor_from_fn(paddle.ones, mesh, [dist.Replicate()], shape=[1]) >>> print(d_tensor)