diff --git a/docs/api/paddle/distributed/fleet/UtilBase_cn.rst b/docs/api/paddle/distributed/fleet/UtilBase_cn.rst index 2db7a38a6ea..4086cc9893c 100644 --- a/docs/api/paddle/distributed/fleet/UtilBase_cn.rst +++ b/docs/api/paddle/distributed/fleet/UtilBase_cn.rst @@ -9,43 +9,43 @@ UtilBase 方法 :::::::::::: all_reduce(input, mode="sum", comm_world="worker") -''''''''' +'''''''''''''''''''''''''''''''''''''''''''''''''' 在指定的通信集合间进行归约操作,并将归约结果返回给集合中每个实例。 **参数** - **input** (list|tuple|numpy.array) – 归约操作的输入。 - **mode** (str) - 归约操作的模式,包含求和,取最大值和取最小值,默认为求和归约。 - - **comm_world** (str) - 归约操作的通信集合,包含:server 集合(``server``),worker 集合(``worker``)及所有节点集合(``all``),默认为 worker 集合。 + - **comm_world** (str) - 归约操作的通信集合,包含:server 集合 (``server``),worker 集合 (``worker``) 及所有节点集合 (``all``),默认为 worker 集合。 **返回** -Numpy.array|None:一个和``input``形状一致的 numpy 数组或 None。 +Numpy.array|None:一个和 ``input`` 形状一致的 numpy 数组或 None。 **代码示例** COPY-FROM: paddle.distributed.fleet.UtilBase.all_reduce barrier(comm_world="worker") -''''''''' +'''''''''''''''''''''''''''' 在指定的通信集合间进行阻塞操作,以实现集合间进度同步。 **参数** - - **comm_world** (str) - 阻塞操作的通信集合,包含:server 集合(``server``),worker 集合(``worker``)及所有节点集合(``all``),默认为 worker 集合。 + - **comm_world** (str) - 阻塞操作的通信集合,包含:server 集合 (``server``),worker 集合 (``worker``) 及所有节点集合 (``all``),默认为 worker 集合。 **代码示例** COPY-FROM: paddle.distributed.fleet.UtilBase.barrier all_gather(input, comm_world="worker") -''''''''' +'''''''''''''''''''''''''''''''''''''''' 在指定的通信集合间进行聚合操作,并将聚合的结果返回给集合中每个实例。 **参数** - **input** (int|float) - 聚合操作的输入。 - - **comm_world** (str) - 聚合操作的通信集合,包含:server 集合(``server``),worker 集合(``worker``)及所有节点集合(``all``),默认为 worker 集合。 + - **comm_world** (str) - 聚合操作的通信集合,包含:server 集合 (``server``),worker 集合 (``worker``) 及所有节点集合 (``all``),默认为 worker 集合。 **返回** @@ -56,7 +56,7 @@ all_gather(input, comm_world="worker") COPY-FROM: paddle.distributed.fleet.UtilBase.all_gather get_file_shard(files) -''''''''' +''''''''''''''''''''' 在数据并行的分布式训练中,获取属于当前训练节点的文件列表。 .. code-block:: text @@ -77,8 +77,7 @@ get_file_shard(files) COPY-FROM: paddle.distributed.fleet.UtilBase.get_file_shard print_on_rank(message, rank_id) -''''''''' - +''''''''''''''''''''''''''''''''' 在编号为 `rank_id` 的节点上打印指定信息。 **参数** diff --git a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md index 80b15dded71..e5b613efc70 100644 --- a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md +++ b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md @@ -60,20 +60,20 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 10 | [torch.Tensor.short](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.short) | paddle.Tensor.short | - | | 11 | [torch.Tensor.cfloat](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.cfloat) | paddle.Tensor.cfloat | - | | 12 | [torch.Tensor.cdouble](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.cdouble) | paddle.Tensor.cdouble | - | -| 13 | [torch.nn.init.calculate_gain](https://pytorch.org/docs/stable/generated/torch.nn.init.calculate_gain.html#torch.nn.init.calculate_gain) | paddle.nn.init.calculate_gain | - | -| 14 | [torch.nn.init.constant_](https://pytorch.org/docs/stable/generated/torch.nn.init.constant_.html#torch.nn.init.constant_) | paddle.nn.init.constant_ | - | -| 15 | [torch.nn.init.dirac_](https://pytorch.org/docs/stable/generated/torch.nn.init.dirac_.html#torch.nn.init.dirac_) | paddle.nn.init.dirac_ | - | -| 16 | [torch.nn.init.eye_](https://pytorch.org/docs/stable/generated/torch.nn.init.eye_.html#torch.nn.init.eye_) | paddle.nn.init.eye_ | - | -| 17 | [torch.nn.init.kaiming_normal_](https://pytorch.org/docs/stable/generated/torch.nn.init.kaiming_normal_.html#torch.nn.init.kaiming_normal_) | paddle.nn.init.kaiming_normal_ | - | -| 18 | [torch.nn.init.kaiming_uniform_](https://pytorch.org/docs/stable/generated/torch.nn.init.kaiming_uniform_.html#torch.nn.init.kaiming_uniform_) | paddle.nn.init.kaiming_uniform_ | - | -| 19 | [torch.nn.init.normal_](https://pytorch.org/docs/stable/generated/torch.nn.init.normal_.html#torch.nn.init.normal_) | paddle.nn.init.normal_ | - | -| 20 | [torch.nn.init.ones_](https://pytorch.org/docs/stable/generated/torch.nn.init.ones_.html#torch.nn.init.ones_) | paddle.nn.init.ones_ | - | -| 21 | [torch.nn.init.orthogonal_](https://pytorch.org/docs/stable/generated/torch.nn.init.orthogonal_.html#torch.nn.init.orthogonal_) | paddle.nn.init.orthogonal_ | - | -| 22 | [torch.nn.init.trunc_normal_](https://pytorch.org/docs/stable/generated/torch.nn.init.trunc_normal_.html#torch.nn.init.trunc_normal_) | paddle.nn.init.trunc_normal_ | - | -| 23 | [torch.nn.init.uniform_](https://pytorch.org/docs/stable/generated/torch.nn.init.uniform_.html#torch.nn.init.uniform_) | paddle.nn.init.uniform_ | - | -| 24 | [torch.nn.init.xavier_normal_](https://pytorch.org/docs/stable/generated/torch.nn.init.xavier_normal_.html#torch.nn.init.xavier_normal_) | paddle.nn.init.xavier_normal_ | - | -| 25 | [torch.nn.init.xavier_uniform_](https://pytorch.org/docs/stable/generated/torch.nn.init.xavier_uniform_.html#torch.nn.init.xavier_uniform_) | paddle.nn.init.xavier_uniform_ | - | -| 26 | [torch.nn.init.zeros_](https://pytorch.org/docs/stable/generated/torch.nn.init.zeros_.html#torch.nn.init.zeros_) | paddle.nn.init.zeros_ | - | +| 13 | [torch.nn.init.calculate_gain](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.calculate_gain) | paddle.nn.init.calculate_gain | - | +| 14 | [torch.nn.init.constant_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.constant_) | paddle.nn.init.constant_ | - | +| 15 | [torch.nn.init.dirac_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.dirac_) | paddle.nn.init.dirac_ | - | +| 16 | [torch.nn.init.eye_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.eye_) | paddle.nn.init.eye_ | - | +| 17 | [torch.nn.init.kaiming_normal_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.kaiming_normal_) | paddle.nn.init.kaiming_normal_ | - | +| 18 | [torch.nn.init.kaiming_uniform_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.kaiming_uniform_) | paddle.nn.init.kaiming_uniform_ | - | +| 19 | [torch.nn.init.normal_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.normal_) | paddle.nn.init.normal_ | - | +| 20 | [torch.nn.init.ones_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.ones_) | paddle.nn.init.ones_ | - | +| 21 | [torch.nn.init.orthogonal_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.orthogonal_) | paddle.nn.init.orthogonal_ | - | +| 22 | [torch.nn.init.trunc_normal_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.trunc_normal_) | paddle.nn.init.trunc_normal_ | - | +| 23 | [torch.nn.init.uniform_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.uniform_) | paddle.nn.init.uniform_ | - | +| 24 | [torch.nn.init.xavier_normal_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.xavier_normal_) | paddle.nn.init.xavier_normal_ | - | +| 25 | [torch.nn.init.xavier_uniform_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.xavier_uniform_) | paddle.nn.init.xavier_uniform_ | - | +| 26 | [torch.nn.init.zeros_](https://pytorch.org/docs/stable/nn.init.html#torch.nn.init.zeros_) | paddle.nn.init.zeros_ | - | | 27 | [torch.nn.Conv1d](https://pytorch.org/docs/stable/generated/torch.nn.Conv1d.html#torch.nn.Conv1d) | paddle.nn.Conv1d | - | | 28 | [torch.nn.Conv2d](https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html#torch.nn.Conv2d) | paddle.nn.Conv2d | - | | 29 | [torch.nn.Conv3d](https://pytorch.org/docs/stable/generated/torch.nn.Conv3d.html#torch.nn.Conv3d) | paddle.nn.Conv3d | - | @@ -108,14 +108,14 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 58 | [torch.autograd.Function](https://pytorch.org/docs/stable/generated/torch.autograd.Function.html#torch.autograd.Function) | paddle.autograd.Function | - | | 59 | [torch.take_along_dim](https://pytorch.org/docs/stable/torch.html#torch.take_along_dim) | paddle.take_along_dim | - | | 60 | [torch.Tensor.take_along_dim](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.take_along_dim) | paddle.Tensor.take_along_dim | - | -| 61 | [torch.special.logsumexp](https://pytorch.org/docs/stable/generated/torch.special.logsumexp.html#torch.special.logsumexp) | paddle.special.logsumexp | - | +| 61 | [torch.special.logsumexp](https://pytorch.org/docs/stable/special.html#torch.special.logsumexp) | paddle.special.logsumexp | - | | 62 | [torch.argwhere](https://pytorch.org/docs/stable/torch.html#torch.argwhere) | paddle.argwhere | - | | 63 | [torch.concatenate](https://pytorch.org/docs/stable/torch.html#torch.concatenate) | paddle.concatenate | - | | 64 | [torch.is_autocast_enabled](https://pytorch.org/docs/stable/torch.html#torch.is_autocast_enabled) | paddle.is_autocast_enabled | - | | 65 | [torch.get_autocast_gpu_dtype](https://pytorch.org/docs/stable/torch.html#torch.get_autocast_gpu_dtype) | paddle.get_autocast_gpu_dtype | - | | 66 | [torch.cumsum](https://pytorch.org/docs/stable/torch.html#torch.cumsum) | paddle.cumsum | - | | 67 | [torch.diff](https://pytorch.org/docs/stable/torch.html#torch.diff) | paddle.diff | - | -| 68 | [torch.nn.functional.dropout1d](https://pytorch.org/docs/stable/generated/torch.nn.functional.dropout1d.html#torch.nn.functional.dropout1d) | paddle.nn.functional.dropout1d | - | +| 68 | [torch.nn.functional.dropout1d](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.dropout1d) | paddle.nn.functional.dropout1d | - | | 69 | [torch.nn.parameter.Parameter](https://pytorch.org/docs/stable/generated/torch.nn.parameter.Parameter.html#torch.nn.parameter.Parameter) | paddle.nn.parameter.Parameter | - | | 70 | [torch.add](https://pytorch.org/docs/stable/torch.html#torch.add) | paddle.add | - | | 71 | [torch.div](https://pytorch.org/docs/stable/torch.html#torch.div) | paddle.div | - | @@ -150,10 +150,10 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 100 | [torch.Tensor.new_full](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.new_full) | paddle.Tensor.new_full | - | | 101 | [torch.Tensor.new_empty](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.new_empty) | paddle.Tensor.new_empty | - | | 102 | [torch.eye](https://pytorch.org/docs/stable/torch.html#torch.eye) | paddle.eye | - | -| 103 | [torch.cuda.cudart](https://pytorch.org/docs/stable/generated/torch.cuda.cudart.html#torch.cuda.cudart) | paddle.cuda.cudart | - | -| 104 | [torch.cuda.check_error](https://pytorch.org/docs/stable/generated/torch.cuda.check_error.html#torch.cuda.check_error) | paddle.cuda.check_error | - | -| 105 | [torch.cuda.mem_get_info](https://pytorch.org/docs/stable/generated/torch.cuda.mem_get_info.html#torch.cuda.mem_get_info) | paddle.cuda.mem_get_info | - | -| 106 | [torch.cuda.is_initialized](https://pytorch.org/docs/stable/generated/torch.cuda.is_initialized.html#torch.cuda.is_initialized) | paddle.cuda.is_initialized | - | +| 103 | [torch.cuda.cudart](https://pytorch.org/docs/stable/cuda.html#torch.cuda.cudart) | paddle.cuda.cudart | - | +| 104 | [torch.cuda.check_error](https://pytorch.org/docs/stable/cuda.html#torch.cuda.check_error) | paddle.cuda.check_error | - | +| 105 | [torch.cuda.mem_get_info](https://pytorch.org/docs/stable/cuda.html#torch.cuda.mem_get_info) | paddle.cuda.mem_get_info | - | +| 106 | [torch.cuda.is_initialized](https://pytorch.org/docs/stable/cuda.html#torch.cuda.is_initialized) | paddle.cuda.is_initialized | - | | 107 | [torch.permute](https://pytorch.org/docs/stable/torch.html#torch.permute) | paddle.permute | - | | 108 | [torch.Tensor.permute](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.permute) | paddle.Tensor.permute | - | | 109 | [torch.repeat_interleave](https://pytorch.org/docs/stable/torch.html#torch.repeat_interleave) | paddle.repeat_interleave | - | @@ -167,7 +167,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 117 | [torch.amax](https://pytorch.org/docs/stable/torch.html#torch.amax) | paddle.amax | - | | 118 | [torch.Tensor.stride](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.stride) | paddle.Tensor.stride | - | | 119 | [torch.Tensor.get_device](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.get_device) | paddle.Tensor.get_device | - | -| 120 | [torch.random.initial_seed](https://pytorch.org/docs/stable/generated/torch.random.initial_seed.html#torch.random.initial_seed) | paddle.random.initial_seed | - | +| 120 | [torch.random.initial_seed](https://pytorch.org/docs/stable/random.html#torch.random.initial_seed) | paddle.random.initial_seed | - | | 121 | [torch.as_tensor](https://pytorch.org/docs/stable/torch.html#torch.as_tensor) | paddle.as_tensor | - | | 122 | [torch.tensor](https://pytorch.org/docs/stable/torch.html#torch.tensor) | paddle.tensor | - | | 123 | [torch.Tensor.copy_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.copy_) | paddle.Tensor.copy_ | - | @@ -184,19 +184,19 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 134 | [torch.LongTensor](https://pytorch.org/docs/stable/torch.html#torch.LongTensor) | paddle.LongTensor | - | | 135 | [torch.BoolTensor](https://pytorch.org/docs/stable/torch.html#torch.BoolTensor) | paddle.BoolTensor | - | | 136 | [torch.norm](https://pytorch.org/docs/stable/torch.html#torch.norm) | paddle.norm | - | -| 137 | [torch.linalg.norm](https://pytorch.org/docs/stable/generated/torch.linalg.norm.html#torch.linalg.norm) | paddle.linalg.norm | - | +| 137 | [torch.linalg.norm](https://pytorch.org/docs/stable/linalg.html#torch.linalg.norm) | paddle.linalg.norm | - | | 138 | [torch.Tensor.size](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.size) | paddle.Tensor.size | - | | 139 | [torch.Tensor.to](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.to) | paddle.Tensor.to | - | -| 140 | [torch.nn.Module.to](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.to) | paddle.nn.Module.to | - | -| 141 | [torch.linalg.vector_norm](https://pytorch.org/docs/stable/generated/torch.linalg.vector_norm.html#torch.linalg.vector_norm) | paddle.linalg.vector_norm | - | -| 142 | [torch.functional.split](https://pytorch.org/docs/stable/generated/torch.functional.split.html#torch.functional.split) | paddle.functional.split | - | -| 143 | [torch.functional.unique_consecutive](https://pytorch.org/docs/stable/generated/torch.functional.unique_consecutive.html#torch.functional.unique_consecutive) | paddle.functional.unique_consecutive | - | -| 144 | [torch.functional.atleast_1d](https://pytorch.org/docs/stable/generated/torch.functional.atleast_1d.html#torch.functional.atleast_1d) | paddle.functional.atleast_1d | - | -| 145 | [torch.functional.atleast_2d](https://pytorch.org/docs/stable/generated/torch.functional.atleast_2d.html#torch.functional.atleast_2d) | paddle.functional.atleast_2d | - | -| 146 | [torch.functional.atleast_3d](https://pytorch.org/docs/stable/generated/torch.functional.atleast_3d.html#torch.functional.atleast_3d) | paddle.functional.atleast_3d | - | -| 147 | [torch.functional.broadcast_shapes](https://pytorch.org/docs/stable/generated/torch.functional.broadcast_shapes.html#torch.functional.broadcast_shapes) | paddle.functional.broadcast_shapes | - | -| 148 | [torch.functional.einsum](https://pytorch.org/docs/stable/generated/torch.functional.einsum.html#torch.functional.einsum) | paddle.functional.einsum | - | -| 149 | [torch.functional.norm](https://pytorch.org/docs/stable/generated/torch.functional.norm.html#torch.functional.norm) | paddle.functional.norm | - | +| 140 | [torch.nn.Module.to](https://pytorch.org/docs/stable/nn.Module.html#torch.nn.Module.to) | paddle.nn.Module.to | - | +| 141 | [torch.linalg.vector_norm](https://pytorch.org/docs/stable/linalg.html#torch.linalg.vector_norm) | paddle.linalg.vector_norm | - | +| 142 | [torch.functional.split](https://pytorch.org/docs/stable/functional.html#torch.functional.split) | paddle.functional.split | - | +| 143 | [torch.functional.unique_consecutive](https://pytorch.org/docs/stable/functional.html#torch.functional.unique_consecutive) | paddle.functional.unique_consecutive | - | +| 144 | [torch.functional.atleast_1d](https://pytorch.org/docs/stable/functional.html#torch.functional.atleast_1d) | paddle.functional.atleast_1d | - | +| 145 | [torch.functional.atleast_2d](https://pytorch.org/docs/stable/functional.html#torch.functional.atleast_2d) | paddle.functional.atleast_2d | - | +| 146 | [torch.functional.atleast_3d](https://pytorch.org/docs/stable/functional.html#torch.functional.atleast_3d) | paddle.functional.atleast_3d | - | +| 147 | [torch.functional.broadcast_shapes](https://pytorch.org/docs/stable/functional.html#torch.functional.broadcast_shapes) | paddle.functional.broadcast_shapes | - | +| 148 | [torch.functional.einsum](https://pytorch.org/docs/stable/functional.html#torch.functional.einsum) | paddle.functional.einsum | - | +| 149 | [torch.functional.norm](https://pytorch.org/docs/stable/functional.html#torch.functional.norm) | paddle.functional.norm | - | | 150 | [torch.multinomial](https://pytorch.org/docs/stable/torch.html#torch.multinomial) | paddle.multinomial | - | | 151 | [torch.var](https://pytorch.org/docs/stable/torch.html#torch.var) | paddle.var | - | | 152 | [torch.rand_like](https://pytorch.org/docs/stable/torch.html#torch.rand_like) | paddle.rand_like | - | @@ -219,9 +219,9 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 169 | [torch.broadcast_shapes](https://pytorch.org/docs/stable/torch.html#torch.broadcast_shapes) | paddle.broadcast_shapes | - | | 170 | [torch.Tensor.scatter_reduce](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.scatter_reduce) | paddle.Tensor.scatter_reduce | - | | 171 | [torch.scatter_reduce](https://pytorch.org/docs/stable/torch.html#torch.scatter_reduce) | paddle.scatter_reduce | - | -| 172 | [torch.nn.functional.silu](https://pytorch.org/docs/stable/generated/torch.nn.functional.silu.html#torch.nn.functional.silu) | paddle.nn.functional.silu | - | +| 172 | [torch.nn.functional.silu](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.silu) | paddle.nn.functional.silu | - | | 173 | [torch.Tensor.softmax](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.softmax) | paddle.Tensor.softmax | - | -| 174 | [torch.special.softmax](https://pytorch.org/docs/stable/generated/torch.special.softmax.html#torch.special.softmax) | paddle.special.softmax | - | +| 174 | [torch.special.softmax](https://pytorch.org/docs/stable/special.html#torch.special.softmax) | paddle.special.softmax | - | | 175 | [torch.softmax](https://pytorch.org/docs/stable/torch.html#torch.softmax) | paddle.softmax | - | | 176 | [torch.Tensor.clamp](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.clamp) | paddle.Tensor.clamp | - | | 177 | [torch.Tensor.itemsize](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.itemsize) | paddle.Tensor.itemsize | - | @@ -248,8 +248,8 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 198 | [torch.Tensor.square](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.square) | paddle.Tensor.square | - | | 199 | [torch.Tensor.tolist](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.tolist) | paddle.Tensor.tolist | - | | 200 | [torch.Tensor.zero_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.zero_) | paddle.Tensor.zero_ | - | -| 201 | [torch.distributed.get_rank](https://pytorch.org/docs/stable/generated/torch.distributed.get_rank.html#torch.distributed.get_rank) | paddle.distributed.get_rank | - | -| 202 | [torch.distributed.get_world_size](https://pytorch.org/docs/stable/generated/torch.distributed.get_world_size.html#torch.distributed.get_world_size) | paddle.distributed.get_world_size | - | +| 201 | [torch.distributed.get_rank](https://pytorch.org/docs/stable/distributed.html#torch.distributed.get_rank) | paddle.distributed.get_rank | - | +| 202 | [torch.distributed.get_world_size](https://pytorch.org/docs/stable/distributed.html#torch.distributed.get_world_size) | paddle.distributed.get_world_size | - | | 203 | [torch.Tensor.shape](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.shape) | paddle.Tensor.shape | - | | 204 | [torch.float32](https://pytorch.org/docs/stable/torch.html#torch.float32) | paddle.float32 | - | | 205 | [torch.long](https://pytorch.org/docs/stable/torch.html#torch.long) | paddle.long | - | @@ -381,15 +381,15 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 331 | [torch.Tensor.trunc_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.trunc_) | paddle.Tensor.trunc_ | - | | 332 | [torch.Tensor.values](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.values) | paddle.Tensor.values | - | | 333 | [torch.\_\_version\_\_](https://pytorch.org/docs/stable/torch.html#torch.__version__) | paddle.\_\_version\_\_ | - | -| 334 | [torch.\_\_version\_\_.split](https://pytorch.org/docs/stable/generated/torch.__version__.split.html#torch.__version__.split) | paddle.\_\_version\_\_.split | - | +| 334 | [torch.\_\_version\_\_.split](https://pytorch.org/docs/stable/__version__.html#torch.__version__.split) | paddle.\_\_version\_\_.split | - | | 335 | [torch.diag_embed](https://pytorch.org/docs/stable/torch.html#torch.diag_embed) | paddle.diag_embed | - | -| 336 | [torch.distributed.ReduceOp.MAX](https://pytorch.org/docs/stable/generated/torch.distributed.ReduceOp.html#torch.distributed.ReduceOp.MAX) | paddle.distributed.ReduceOp.MAX | - | -| 337 | [torch.distributed.ReduceOp.MIN](https://pytorch.org/docs/stable/generated/torch.distributed.ReduceOp.html#torch.distributed.ReduceOp.MIN) | paddle.distributed.ReduceOp.MIN | - | -| 338 | [torch.distributed.ReduceOp.SUM](https://pytorch.org/docs/stable/generated/torch.distributed.ReduceOp.html#torch.distributed.ReduceOp.SUM) | paddle.distributed.ReduceOp.SUM | - | -| 339 | [torch.distributed.batch_isend_irecv](https://pytorch.org/docs/stable/generated/torch.distributed.batch_isend_irecv.html#torch.distributed.batch_isend_irecv) | paddle.distributed.batch_isend_irecv | - | -| 340 | [torch.distributed.get_backend](https://pytorch.org/docs/stable/generated/torch.distributed.get_backend.html#torch.distributed.get_backend) | paddle.distributed.get_backend | - | -| 341 | [torch.distributed.is_available](https://pytorch.org/docs/stable/generated/torch.distributed.is_available.html#torch.distributed.is_available) | paddle.distributed.is_available | - | -| 342 | [torch.distributed.is_initialized](https://pytorch.org/docs/stable/generated/torch.distributed.is_initialized.html#torch.distributed.is_initialized) | paddle.distributed.is_initialized | - | +| 336 | [torch.distributed.ReduceOp.MAX](https://pytorch.org/docs/stable/generated/torch.distributed.ReduceOp.MAX.html#torch.distributed.ReduceOp.MAX) | paddle.distributed.ReduceOp.MAX | - | +| 337 | [torch.distributed.ReduceOp.MIN](https://pytorch.org/docs/stable/generated/torch.distributed.ReduceOp.MIN.html#torch.distributed.ReduceOp.MIN) | paddle.distributed.ReduceOp.MIN | - | +| 338 | [torch.distributed.ReduceOp.SUM](https://pytorch.org/docs/stable/generated/torch.distributed.ReduceOp.SUM.html#torch.distributed.ReduceOp.SUM) | paddle.distributed.ReduceOp.SUM | - | +| 339 | [torch.distributed.batch_isend_irecv](https://pytorch.org/docs/stable/distributed.html#torch.distributed.batch_isend_irecv) | paddle.distributed.batch_isend_irecv | - | +| 340 | [torch.distributed.get_backend](https://pytorch.org/docs/stable/distributed.html#torch.distributed.get_backend) | paddle.distributed.get_backend | - | +| 341 | [torch.distributed.is_available](https://pytorch.org/docs/stable/distributed.html#torch.distributed.is_available) | paddle.distributed.is_available | - | +| 342 | [torch.distributed.is_initialized](https://pytorch.org/docs/stable/distributed.html#torch.distributed.is_initialized) | paddle.distributed.is_initialized | - | | 343 | [torch.e](https://pytorch.org/docs/stable/torch.html#torch.e) | paddle.e | - | | 344 | [torch.enable_grad](https://pytorch.org/docs/stable/torch.html#torch.enable_grad) | paddle.enable_grad | - | | 345 | [torch.inf](https://pytorch.org/docs/stable/torch.html#torch.inf) | paddle.inf | - | @@ -404,13 +404,13 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 354 | [torch.nn.Tanhshrink](https://pytorch.org/docs/stable/generated/torch.nn.Tanhshrink.html#torch.nn.Tanhshrink) | paddle.nn.Tanhshrink | - | | 355 | [torch.nn.TransformerDecoder](https://pytorch.org/docs/stable/generated/torch.nn.TransformerDecoder.html#torch.nn.TransformerDecoder) | paddle.nn.TransformerDecoder | - | | 356 | [torch.nn.TripletMarginWithDistanceLoss](https://pytorch.org/docs/stable/generated/torch.nn.TripletMarginWithDistanceLoss.html#torch.nn.TripletMarginWithDistanceLoss) | paddle.nn.TripletMarginWithDistanceLoss | - | -| 357 | [torch.nn.utils.parameters_to_vector](https://pytorch.org/docs/stable/generated/torch.nn.utils.parameters_to_vector.html#torch.nn.utils.parameters_to_vector) | paddle.nn.utils.parameters_to_vector | - | -| 358 | [torch.nn.utils.vector_to_parameters](https://pytorch.org/docs/stable/generated/torch.nn.utils.vector_to_parameters.html#torch.nn.utils.vector_to_parameters) | paddle.nn.utils.vector_to_parameters | - | +| 357 | [torch.nn.utils.parameters_to_vector](https://pytorch.org/docs/stable/nn.utils.html#torch.nn.utils.parameters_to_vector) | paddle.nn.utils.parameters_to_vector | - | +| 358 | [torch.nn.utils.vector_to_parameters](https://pytorch.org/docs/stable/nn.utils.html#torch.nn.utils.vector_to_parameters) | paddle.nn.utils.vector_to_parameters | - | | 359 | [torch.pi](https://pytorch.org/docs/stable/torch.html#torch.pi) | paddle.pi | - | | 360 | [torch.set_default_dtype](https://pytorch.org/docs/stable/torch.html#torch.set_default_dtype) | paddle.set_default_dtype | - | | 361 | [torch.t](https://pytorch.org/docs/stable/torch.html#torch.t) | paddle.t | - | | 362 | [torch.utils.cpp_extension.BuildExtension](https://pytorch.org/docs/stable/generated/torch.utils.cpp_extension.BuildExtension.html#torch.utils.cpp_extension.BuildExtension) | paddle.utils.cpp_extension.BuildExtension | - | -| 363 | [torch.utils.cpp_extension.BuildExtension.with_options](https://pytorch.org/docs/stable/generated/torch.utils.cpp_extension.BuildExtension.html#torch.utils.cpp_extension.BuildExtension.with_options) | paddle.utils.cpp_extension.BuildExtension.with_options | - | +| 363 | [torch.utils.cpp_extension.BuildExtension.with_options](https://pytorch.org/docs/stable/utils.cpp_extension.BuildExtension.html#torch.utils.cpp_extension.BuildExtension.with_options) | paddle.utils.cpp_extension.BuildExtension.with_options | - | | 364 | [torch.Tensor.element_size](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.element_size) | paddle.Tensor.element_size | - | | 365 | [torch.Tensor.view_as](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.view_as) | paddle.Tensor.view_as | - | | 366 | [torch.dtype](https://pytorch.org/docs/stable/torch.html#torch.dtype) | paddle.dtype | - | @@ -429,7 +429,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 379 | [torch.Tensor.\_\_rtruediv\_\_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.__rtruediv__) | paddle.Tensor.\_\_rtruediv\_\_ | - | | 380 | [torch.Tensor.\_\_setitem\_\_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.__setitem__) | paddle.Tensor.\_\_setitem\_\_ | - | | 381 | [torch.matmul](https://pytorch.org/docs/stable/torch.html#torch.matmul) | paddle.matmul | - | -| 382 | [torch.linalg.matmul](https://pytorch.org/docs/stable/generated/torch.linalg.matmul.html#torch.linalg.matmul) | paddle.linalg.matmul | - | +| 382 | [torch.linalg.matmul](https://pytorch.org/docs/stable/linalg.html#torch.linalg.matmul) | paddle.linalg.matmul | - | | 383 | [torch.Tensor.multiply](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.multiply) | paddle.Tensor.multiply | - | | 384 | [torch.Tensor.multiply_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.multiply_) | paddle.Tensor.multiply_ | - | | 385 | [torch.Tensor.matmul](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.matmul) | paddle.Tensor.matmul | - | @@ -439,7 +439,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 389 | [torch.Tensor.remainder](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.remainder) | paddle.Tensor.remainder | - | | 390 | [torch.remainder](https://pytorch.org/docs/stable/torch.html#torch.remainder) | paddle.remainder | - | | 391 | [torch.broadcast_to](https://pytorch.org/docs/stable/torch.html#torch.broadcast_to) | paddle.broadcast_to | - | -| 392 | [torch.nn.functional.embedding](https://pytorch.org/docs/stable/generated/torch.nn.functional.embedding.html#torch.nn.functional.embedding) | paddle.nn.functional.embedding | - | +| 392 | [torch.nn.functional.embedding](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.embedding) | paddle.nn.functional.embedding | - | | 393 | [torch.no_grad](https://pytorch.org/docs/stable/torch.html#torch.no_grad) | paddle.no_grad | - | | 394 | [torch.reshape](https://pytorch.org/docs/stable/torch.html#torch.reshape) | paddle.reshape | - | | 395 | [torch.Tensor.bitwise_or_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.bitwise_or_) | paddle.Tensor.bitwise_or_ | - | @@ -472,7 +472,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 422 | [torch.chunk](https://pytorch.org/docs/stable/torch.html#torch.chunk) | paddle.chunk | - | | 423 | [torch.Tensor.chunk](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.chunk) | paddle.Tensor.chunk | - | | 424 | [torch.any](https://pytorch.org/docs/stable/torch.html#torch.any) | paddle.any | - | -| 425 | [torch.nn.functional.one_hot](https://pytorch.org/docs/stable/generated/torch.nn.functional.one_hot.html#torch.nn.functional.one_hot) | paddle.nn.functional.one_hot | - | +| 425 | [torch.nn.functional.one_hot](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.one_hot) | paddle.nn.functional.one_hot | - | | 426 | [torch.unbind](https://pytorch.org/docs/stable/torch.html#torch.unbind) | paddle.unbind | - | | 427 | [torch.Tensor.unbind](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.unbind) | paddle.Tensor.unbind | - | | 428 | [torch.is_floating_point](https://pytorch.org/docs/stable/torch.html#torch.is_floating_point) | paddle.is_floating_point | - | @@ -489,7 +489,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 439 | [torch.Tensor.all](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.all) | paddle.Tensor.all | - | | 440 | [torch.Tensor.any](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.any) | paddle.Tensor.any | - | | 441 | [torch.tensor_split](https://pytorch.org/docs/stable/torch.html#torch.tensor_split) | paddle.tensor_split | - | -| 442 | [torch.nn.functional.gelu](https://pytorch.org/docs/stable/generated/torch.nn.functional.gelu.html#torch.nn.functional.gelu) | paddle.nn.functional.gelu | - | +| 442 | [torch.nn.functional.gelu](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.gelu) | paddle.nn.functional.gelu | - | | 443 | [torch.layer_norm](https://pytorch.org/docs/stable/torch.html#torch.layer_norm) | paddle.layer_norm | - | | 444 | [torch.logical_not](https://pytorch.org/docs/stable/torch.html#torch.logical_not) | paddle.logical_not | - | | 445 | [torch.Tensor.logical_not](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.logical_not) | paddle.Tensor.logical_not | - | @@ -503,9 +503,9 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 453 | [torch.Tensor.index_select](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.index_select) | paddle.Tensor.index_select | - | | 454 | [torch.dot](https://pytorch.org/docs/stable/torch.html#torch.dot) | paddle.dot | - | | 455 | [torch.Tensor.dot](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.dot) | paddle.Tensor.dot | - | -| 456 | [torch.nn.functional.conv1d](https://pytorch.org/docs/stable/generated/torch.nn.functional.conv1d.html#torch.nn.functional.conv1d) | paddle.nn.functional.conv1d | - | -| 457 | [torch.nn.functional.conv2d](https://pytorch.org/docs/stable/generated/torch.nn.functional.conv2d.html#torch.nn.functional.conv2d) | paddle.nn.functional.conv2d | - | -| 458 | [torch.nn.functional.conv3d](https://pytorch.org/docs/stable/generated/torch.nn.functional.conv3d.html#torch.nn.functional.conv3d) | paddle.nn.functional.conv3d | - | +| 456 | [torch.nn.functional.conv1d](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.conv1d) | paddle.nn.functional.conv1d | - | +| 457 | [torch.nn.functional.conv2d](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.conv2d) | paddle.nn.functional.conv2d | - | +| 458 | [torch.nn.functional.conv3d](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.conv3d) | paddle.nn.functional.conv3d | - | | 459 | [torch.conv1d](https://pytorch.org/docs/stable/torch.html#torch.conv1d) | paddle.conv1d | - | | 460 | [torch.conv2d](https://pytorch.org/docs/stable/torch.html#torch.conv2d) | paddle.conv2d | - | | 461 | [torch.conv3d](https://pytorch.org/docs/stable/torch.html#torch.conv3d) | paddle.conv3d | - | @@ -534,7 +534,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 484 | [torch.Tensor.is_contiguous](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.is_contiguous) | paddle.Tensor.is_contiguous | - | | 485 | [torch.utils.cpp_extension.CUDA_HOME](https://pytorch.org/docs/stable/generated/torch.utils.cpp_extension.CUDA_HOME.html#torch.utils.cpp_extension.CUDA_HOME) | paddle.utils.cpp_extension.CUDA_HOME | - | | 486 | [torch.Tensor.is_coalesced](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.is_coalesced) | paddle.Tensor.is_coalesced | - | -| 487 | [torch.torch.int32](https://pytorch.org/docs/stable/generated/torch.torch.int32.html#torch.torch.int32) | paddle.paddle.int32 | - | +| 487 | [torch.torch.int32](https://pytorch.org/docs/stable/torch.html#torch.torch.int32) | paddle.paddle.int32 | - | | 488 | [torch.transpose](https://pytorch.org/docs/stable/torch.html#torch.transpose) | paddle.transpose | - | | 489 | [torch.Tensor.transpose](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.transpose) | paddle.Tensor.transpose | - | | 490 | [torch.unsqueeze](https://pytorch.org/docs/stable/torch.html#torch.unsqueeze) | paddle.unsqueeze | - | @@ -542,7 +542,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 492 | [torch.sigmoid](https://pytorch.org/docs/stable/torch.html#torch.sigmoid) | paddle.sigmoid | - | | 493 | [torch.Tensor.topk](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.topk) | paddle.Tensor.topk | - | | 494 | [torch.outer](https://pytorch.org/docs/stable/torch.html#torch.outer) | paddle.outer | - | -| 495 | [torch.nn.functional.sigmoid](https://pytorch.org/docs/stable/generated/torch.nn.functional.sigmoid.html#torch.nn.functional.sigmoid) | paddle.nn.functional.sigmoid | - | +| 495 | [torch.nn.functional.sigmoid](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.sigmoid) | paddle.nn.functional.sigmoid | - | | 496 | [torch.Tensor.requires_grad](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.requires_grad) | paddle.Tensor.requires_grad | - | | 497 | [torch.Tensor.data](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.data) | paddle.Tensor.data | - | | 498 | [torch.Tensor.cpu](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.cpu) | paddle.Tensor.cpu | - | @@ -560,10 +560,10 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 510 | [torch.Tensor.\_\_reduce\_ex\_\_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.__reduce_ex__) | paddle.Tensor.\_\_reduce\_ex\_\_ | - | | 511 | [torch.from_numpy](https://pytorch.org/docs/stable/torch.html#torch.from_numpy) | paddle.from_numpy | - | | 512 | [torch.greater](https://pytorch.org/docs/stable/torch.html#torch.greater) | paddle.greater | - | -| 513 | [torch.nn.functional.layer_norm](https://pytorch.org/docs/stable/generated/torch.nn.functional.layer_norm.html#torch.nn.functional.layer_norm) | paddle.nn.functional.layer_norm | - | -| 514 | [torch.nn.attention.sdpa_kernel](https://pytorch.org/docs/stable/generated/torch.nn.attention.sdpa_kernel.html#torch.nn.attention.sdpa_kernel) | paddle.nn.attention.sdpa_kernel | - | +| 513 | [torch.nn.functional.layer_norm](https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.layer_norm) | paddle.nn.functional.layer_norm | - | +| 514 | [torch.nn.attention.sdpa_kernel](https://pytorch.org/docs/stable/nn.attention.html#torch.nn.attention.sdpa_kernel) | paddle.nn.attention.sdpa_kernel | - | | 515 | [torch.nn.attention.SDPBackend](https://pytorch.org/docs/stable/generated/torch.nn.attention.SDPBackend.html#torch.nn.attention.SDPBackend) | paddle.nn.attention.SDPBackend | - | -| 516 | [torch.nn.attention._cur_sdpa_kernel_backends](https://pytorch.org/docs/stable/generated/torch.nn.attention._cur_sdpa_kernel_backends.html#torch.nn.attention._cur_sdpa_kernel_backends) | paddle.nn.attention._cur_sdpa_kernel_backends | - | +| 516 | [torch.nn.attention._cur_sdpa_kernel_backends](https://pytorch.org/docs/stable/nn.attention.html#torch.nn.attention._cur_sdpa_kernel_backends) | paddle.nn.attention._cur_sdpa_kernel_backends | - | | 517 | [torch.nn.SiLU](https://pytorch.org/docs/stable/generated/torch.nn.SiLU.html#torch.nn.SiLU) | paddle.nn.SiLU | - | | 518 | [torch.randperm](https://pytorch.org/docs/stable/torch.html#torch.randperm) | paddle.randperm | - | | 519 | [torch.Tensor.ge](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.ge) | paddle.Tensor.ge | - | @@ -587,22 +587,22 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 537 | [torch.Tensor.scatter](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.scatter) | paddle.Tensor.scatter | - | | 538 | [torch.Tensor.scatter_](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.scatter_) | paddle.Tensor.scatter_ | - | | 539 | [torch.scatter](https://pytorch.org/docs/stable/torch.html#torch.scatter) | paddle.scatter | - | -| 540 | [torch.cuda.get_device_properties](https://pytorch.org/docs/stable/generated/torch.cuda.get_device_properties.html#torch.cuda.get_device_properties) | paddle.cuda.get_device_properties | - | -| 541 | [torch.cuda.get_rng_state](https://pytorch.org/docs/stable/generated/torch.cuda.get_rng_state.html#torch.cuda.get_rng_state) | paddle.cuda.get_rng_state | - | -| 542 | [torch.cuda.is_current_stream_capturing](https://pytorch.org/docs/stable/generated/torch.cuda.is_current_stream_capturing.html#torch.cuda.is_current_stream_capturing) | paddle.cuda.is_current_stream_capturing | - | -| 543 | [torch.cuda.manual_seed_all](https://pytorch.org/docs/stable/generated/torch.cuda.manual_seed_all.html#torch.cuda.manual_seed_all) | paddle.cuda.manual_seed_all | - | -| 544 | [torch.cuda.set_rng_state](https://pytorch.org/docs/stable/generated/torch.cuda.set_rng_state.html#torch.cuda.set_rng_state) | paddle.cuda.set_rng_state | - | +| 540 | [torch.cuda.get_device_properties](https://pytorch.org/docs/stable/cuda.html#torch.cuda.get_device_properties) | paddle.cuda.get_device_properties | - | +| 541 | [torch.cuda.get_rng_state](https://pytorch.org/docs/stable/cuda.html#torch.cuda.get_rng_state) | paddle.cuda.get_rng_state | - | +| 542 | [torch.cuda.is_current_stream_capturing](https://pytorch.org/docs/stable/cuda.html#torch.cuda.is_current_stream_capturing) | paddle.cuda.is_current_stream_capturing | - | +| 543 | [torch.cuda.manual_seed_all](https://pytorch.org/docs/stable/cuda.html#torch.cuda.manual_seed_all) | paddle.cuda.manual_seed_all | - | +| 544 | [torch.cuda.set_rng_state](https://pytorch.org/docs/stable/cuda.html#torch.cuda.set_rng_state) | paddle.cuda.set_rng_state | - | | 545 | [torch.get_device_module](https://pytorch.org/docs/stable/torch.html#torch.get_device_module) | paddle.get_device_module | - | -| 546 | [torch.cuda.is_available](https://pytorch.org/docs/stable/generated/torch.cuda.is_available.html#torch.cuda.is_available) | paddle.cuda.is_available | - | +| 546 | [torch.cuda.is_available](https://pytorch.org/docs/stable/cuda.html#torch.cuda.is_available) | paddle.cuda.is_available | - | | 547 | [torch.device](https://pytorch.org/docs/stable/torch.html#torch.device) | paddle.device | - | -| 548 | [torch.cuda.get_device_capability](https://pytorch.org/docs/stable/generated/torch.cuda.get_device_capability.html#torch.cuda.get_device_capability) | paddle.cuda.get_device_capability | - | -| 549 | [torch.cuda.current_device](https://pytorch.org/docs/stable/generated/torch.cuda.current_device.html#torch.cuda.current_device) | paddle.cuda.current_device | - | -| 550 | [torch.cuda.device_count](https://pytorch.org/docs/stable/generated/torch.cuda.device_count.html#torch.cuda.device_count) | paddle.cuda.device_count | - | -| 551 | [torch.cuda.empty_cache](https://pytorch.org/docs/stable/generated/torch.cuda.empty_cache.html#torch.cuda.empty_cache) | paddle.cuda.empty_cache | - | -| 552 | [torch.cuda.memory_allocated](https://pytorch.org/docs/stable/generated/torch.cuda.memory_allocated.html#torch.cuda.memory_allocated) | paddle.cuda.memory_allocated | - | -| 553 | [torch.cuda.memory_reserved](https://pytorch.org/docs/stable/generated/torch.cuda.memory_reserved.html#torch.cuda.memory_reserved) | paddle.cuda.memory_reserved | - | -| 554 | [torch.cuda.set_device](https://pytorch.org/docs/stable/generated/torch.cuda.set_device.html#torch.cuda.set_device) | paddle.cuda.set_device | - | -| 555 | [torch.cuda.current_stream](https://pytorch.org/docs/stable/generated/torch.cuda.current_stream.html#torch.cuda.current_stream) | paddle.cuda.current_stream | - | +| 548 | [torch.cuda.get_device_capability](https://pytorch.org/docs/stable/cuda.html#torch.cuda.get_device_capability) | paddle.cuda.get_device_capability | - | +| 549 | [torch.cuda.current_device](https://pytorch.org/docs/stable/cuda.html#torch.cuda.current_device) | paddle.cuda.current_device | - | +| 550 | [torch.cuda.device_count](https://pytorch.org/docs/stable/cuda.html#torch.cuda.device_count) | paddle.cuda.device_count | - | +| 551 | [torch.cuda.empty_cache](https://pytorch.org/docs/stable/cuda.html#torch.cuda.empty_cache) | paddle.cuda.empty_cache | - | +| 552 | [torch.cuda.memory_allocated](https://pytorch.org/docs/stable/cuda.html#torch.cuda.memory_allocated) | paddle.cuda.memory_allocated | - | +| 553 | [torch.cuda.memory_reserved](https://pytorch.org/docs/stable/cuda.html#torch.cuda.memory_reserved) | paddle.cuda.memory_reserved | - | +| 554 | [torch.cuda.set_device](https://pytorch.org/docs/stable/cuda.html#torch.cuda.set_device) | paddle.cuda.set_device | - | +| 555 | [torch.cuda.current_stream](https://pytorch.org/docs/stable/cuda.html#torch.cuda.current_stream) | paddle.cuda.current_stream | - | ### 2. 仅 API 调用方式不一致 **分类简介** diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore b/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore index 0c071ca6492..ce0df2c5626 100644 --- a/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore +++ b/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore @@ -22,3 +22,4 @@ alias_refer_failed.log toc_warnings.txt unique_warnings.txt link_warnings.txt +url_warnings.txt diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/generate_pytorch_api_mapping.py b/docs/guides/model_convert/convert_from_pytorch/tools/generate_pytorch_api_mapping.py index a13d3b38452..78b5d68f36f 100644 --- a/docs/guides/model_convert/convert_from_pytorch/tools/generate_pytorch_api_mapping.py +++ b/docs/guides/model_convert/convert_from_pytorch/tools/generate_pytorch_api_mapping.py @@ -11,7 +11,7 @@ def get_pytorch_url(torch_api: str) -> str: 根据PyTorch API名称生成其官方文档URL Args: - api_name: PyTorch API的全限定名(如'torch.add', 'torch.nn.Linear', 'torch.Tensor.add') + torch_api: PyTorch API的全限定名(如'torch.add', 'torch.nn.Linear', 'torch.Tensor.add') Returns: 对应API的官方文档URL字符串 @@ -19,45 +19,56 @@ def get_pytorch_url(torch_api: str) -> str: Rules: 1. Tensor相关API指向tensors.html 2. 顶层函数(torch.xxx)指向torch.html - 3. 类/独立函数指向generated/[name].html - 4. 类方法指向父类页面#锚点 - 5. 特殊处理torchvision等子库的URL结构 + 3. 模块级函数/常量指向模块名.html(如nn.init.html) + 4. 类/独立函数指向generated/[name].html + 5. 类方法指向父类页面#锚点 + 6. 特殊处理torchvision等子库的URL结构 """ base_url = "https://pytorch.org/docs/stable/" api_name = torch_api.replace(r"\_", "_") - # 1. 处理Tensor相关API(特殊页面) + + # 特殊子库处理(torchvision) + if api_name.startswith("torchvision."): + vision_base = "https://pytorch.org/vision/stable/" + if api_name == "torchvision.models": + return f"{vision_base}models.html" + return f"{vision_base}generated/{api_name}.html#{api_name}" + + # 1. 处理Tensor相关API if api_name.startswith("torch.Tensor") or api_name == "torch.Tensor": return f"{base_url}tensors.html#{api_name}" - parts = api_name.split(".") - # 2. 处理顶层函数(无子模块) - if len(parts) == 2 and parts[0] == "torch": + if len(api_name.split(".")) == 2 and api_name.startswith("torch."): return f"{base_url}torch.html#{api_name}" - # 3. 识别类名首字母大写的部分(PyTorch命名规范) - base_parts = [] - found_class = False - for part in parts: - if part and part[0].isupper(): # 检测类名(首字母大写) - found_class = True - base_parts.append(part) - if found_class: - break # 定位到最近的类名 - - # 4. 根据不同情况生成URL - if found_class: - base_name = ".".join(base_parts) - # 处理torchvision等子库 - if api_name.startswith("torchvision."): - return f"https://pytorch.org/vision/stable/generated/{base_name}.html#{api_name}" - return f"{base_url}generated/{base_name}.html#{api_name}" - else: - # 5. 处理独立函数 - if api_name.startswith("torchvision."): - return f"https://pytorch.org/vision/stable/generated/{api_name}.html#{api_name}" + # 分割API路径 + parts = api_name.split(".") + module_path = ".".join(parts[:-1]) # 模块路径 + item_name = parts[-1] # 最后一项名称 + + # 3. 处理模块级函数/常量 + if parts[0] == "torch" and not parts[-1][0].isupper(): + # 特殊模块映射(基于官方文档结构) + module_map = { + "torch.nn.init": "nn.init", + "torch.nn.functional": "nn.functional", + "torch.cuda.amp": "amp", + "torch.distributions": "distributions", + } + module_key = ".".join(parts[:-1]) + module_slug = module_map.get( + module_key, module_key.replace("torch.", "") + ) + return f"{base_url}{module_slug}.html#{api_name}" + + # 4. 处理类/独立函数 + if parts[-1][0].isupper() or len(parts) == 1: return f"{base_url}generated/{api_name}.html#{api_name}" + # 5. 默认处理(类方法) + return f"{base_url}generated/{module_path}.html#{api_name}" + def escape_underscores_in_api(api_name): r""" diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference.py b/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference.py index 218b6fb5af4..de4418471d8 100644 --- a/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference.py +++ b/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference.py @@ -1,11 +1,19 @@ import argparse +import concurrent.futures import os import re from collections import defaultdict +from urllib.parse import urlparse + +import requests +from tqdm import tqdm # 用于显示进度条 # 默认文件路径 DEFAULT_FILE_PATH = "/workspace/paddleDocs/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md" +# 用户代理头,模拟浏览器访问 +USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" + def parse_toc(lines): """ @@ -305,6 +313,142 @@ def extract_all_urls(categories): return urls_with_context +def is_valid_url(url): + """ + 检查URL是否有效 + """ + try: + result = urlparse(url) + return all([result.scheme, result.netloc]) + except ValueError: + return False + + +def check_url_exists(url_info): + """ + 检查URL是否存在(是否返回404) + 返回状态码和错误信息 + """ + url = url_info["url"] + + # 检查URL是否有效 + if not is_valid_url(url): + return { + "status": "invalid", + "status_code": None, + "error": "无效的URL格式", + "url_info": url_info, + } + + # 设置请求头 + headers = {"User-Agent": USER_AGENT} + + try: + # 发送HEAD请求(更快,节省带宽) + response = requests.head( + url, headers=headers, timeout=10, allow_redirects=True + ) + status_code = response.status_code + + # 如果HEAD请求不被支持(405错误),则尝试GET请求 + if status_code == 405: + response = requests.get( + url, headers=headers, timeout=10, allow_redirects=True + ) + status_code = response.status_code + + # 根据状态码判断URL是否存在 + if status_code == 200: + return { + "status": "ok", + "status_code": status_code, + "error": None, + "url_info": url_info, + } + elif status_code == 404: + return { + "status": "not_found", + "status_code": status_code, + "error": "页面不存在", + "url_info": url_info, + } + elif 400 <= status_code < 500: + return { + "status": "client_error", + "status_code": status_code, + "error": "客户端错误", + "url_info": url_info, + } + elif 500 <= status_code < 600: + return { + "status": "server_error", + "status_code": status_code, + "error": "服务器错误", + "url_info": url_info, + } + else: + return { + "status": "other_error", + "status_code": status_code, + "error": f"HTTP状态码: {status_code}", + "url_info": url_info, + } + + except requests.exceptions.RequestException as e: + return { + "status": "request_error", + "status_code": None, + "error": str(e), + "url_info": url_info, + } + + +def check_urls_exist(urls_with_context, max_workers=10): + """ + 使用多线程检查所有URL是否存在(是否返回404) + 返回警告列表 + """ + warnings = [] + total_urls = len(urls_with_context) + + print( + f"开始使用多线程检查 {total_urls} 个URL的存在性(线程数:{max_workers})..." + ) + + with ( + tqdm(total=total_urls, desc="检查URL") as pbar, + concurrent.futures.ThreadPoolExecutor( + max_workers=max_workers + ) as executor, + ): + # 提交所有任务 + future_to_url = { + executor.submit(check_url_exists, url_info): url_info + for url_info in urls_with_context + } + + # 处理完成的任务 + for future in concurrent.futures.as_completed(future_to_url): + result = future.result() + + # 更新进度条 + pbar.update(1) + + # 如果不是200状态码,则添加到警告列表 + if result["status"] != "ok": + warning_msg = ( + f"URL访问错误: {result['error']}\n" + f"URL: {result['url_info']['url']}\n" + f"上下文: {result['url_info']['context']}\n" + ) + if result["status_code"]: + warning_msg += f"状态码: {result['status_code']}\n" + warnings.append(warning_msg) + + print(f"URL检查完成,发现 {len(warnings)} 个问题") + return warnings + + def main(): parser = argparse.ArgumentParser(description="Markdown 文件校验工具") parser.add_argument( @@ -313,6 +457,12 @@ def main(): help="要校验的 Markdown 文件路径", default=DEFAULT_FILE_PATH, ) + parser.add_argument( + "--skip-url-check", + action="store_true", + help="跳过URL存在性检查(避免网络请求)", + ) + args = parser.parse_args() current_script_path = os.path.abspath(__file__) @@ -354,12 +504,12 @@ def main(): print(f"找到 {len(toc)} 个目录条目") print(f"找到 {len(categories)} 个类别") - # 执行三个校验 + # 执行三个基本校验 toc_warnings = check_toc_consistency(toc, categories) unique_warnings = check_unique_torch_apis(categories) link_warnings = check_links_exist(categories) - # 输出警告到文件(保存在 tools_dir 路径下) + # 输出警告到文件 if toc_warnings: output_path = os.path.join(tools_dir, "toc_warnings.txt") with open(output_path, "w", encoding="utf-8") as f: @@ -381,8 +531,34 @@ def main(): f.writelines(warning + "\n" for warning in link_warnings) print(f"生成 {output_path},包含 {len(link_warnings)} 个警告") + # 执行URL存在性检查(除非明确跳过) + url_warnings = [] + if not args.skip_url_check: + # 提取所有URL + urls_with_context = extract_all_urls(categories) + print(f"找到 {len(urls_with_context)} 个URL需要检查") + + # 检查URL存在性(使用多线程) + url_warnings = check_urls_exist( + urls_with_context, max(os.cpu_count() - 4, 1) + ) + + if url_warnings: + output_path = os.path.join(tools_dir, "url_warnings.txt") + with open(output_path, "w", encoding="utf-8") as f: + f.write("URL存在性校验警告:\n") + f.writelines(warning + "\n" for warning in url_warnings) + print(f"生成 {output_path},包含 {len(url_warnings)} 个警告") + else: + print("跳过URL存在性检查") + # 如果没有警告,输出成功信息 - if not toc_warnings and not unique_warnings and not link_warnings: + if ( + not toc_warnings + and not unique_warnings + and not link_warnings + and not url_warnings + ): print("所有校验通过,没有发现警告!")