diff --git a/README.md b/README.md index ba699039ba4bbc11655228b6b44d2ed7db046f67..938c5d4a2a2d94a3958631a8205312da2ab6016f 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ x2paddle --convert_torch_project --project_dir=torch_project --save_dir=paddle_p ## 转换教程 1. [TensorFlow预测模型转换教程](./docs/inference_model_convertor/demo/tensorflow2paddle.ipynb) 2. [PyTorch预测模型转换教程](./docs/inference_model_convertor/demo/pytorch2paddle.ipynb) -3. [PyTorch训练项目转换教程](./docs/pytorch_project_convertor/demo.md) +3. [PyTorch训练项目转换教程](./docs/pytorch_project_convertor/demo/README.md) ## 更新历史 **2020.12.09** diff --git a/docs/inference_model_convertor/FAQ.md b/docs/inference_model_convertor/FAQ.md index a016e52b7354b139940717e7d816bf0992328070..293229dc0aa061a5b02fde9c00f5c7c940645c0d 100644 --- a/docs/inference_model_convertor/FAQ.md +++ b/docs/inference_model_convertor/FAQ.md @@ -33,5 +33,5 @@ out =main(ipt) ``` > 若运行代码无误,则说明代码中有op不支持动转静,我们将会再未来支持;若报错,则说明pytorch2paddle转换出错,请提issue,我们将及时回复。 -**Q5. 目前支持了哪些op的转换呢?** -A: 可详见[X2Paddle支持的op列表](./docs/introduction/op_list.md)。 +**Q5. 目前支持了哪些op的转换呢?** +A: 可详见[X2Paddle支持的op列表](./docs/inference_model_convertor/op_list.md)。 diff --git a/docs/introduction/op_list.md b/docs/inference_model_convertor/op_list.md similarity index 100% rename from docs/introduction/op_list.md rename to docs/inference_model_convertor/op_list.md diff --git a/docs/introduction/x2paddle_model_zoo.md b/docs/introduction/x2paddle_model_zoo.md index 6e3db0718db15456b25a94ed217d6f77f7fb07c1..7c45808197943f745748349a35bef6f973b5e712 100644 --- a/docs/introduction/x2paddle_model_zoo.md +++ b/docs/introduction/x2paddle_model_zoo.md @@ -103,8 +103,7 @@ ## PyTorch训练项目 | 模型 | 转换前代码 | 转换后代码 | |------|----------|------| -| StaGAN | [code](https://github.com/yunjey/stargan)|[code](https://github.com/SunAhong1993/stargan/tree/paddle)| +| StarGAN | [code](https://github.com/yunjey/stargan)|[code](https://github.com/SunAhong1993/stargan/tree/paddle)| | Ultra-Light-Fast-Generic-Face-Detector | [code](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) |[code](https://github.com/SunAhong1993/Ultra-Light-Fast-Generic-Face-Detector-1MB/tree/paddle)| - -**注:** 受限于不同框架的差异,部分模型可能会存在目前无法转换的情况,如TensorFlow中包含控制流的模型,NLP模型等。对于CV常见的模型,如若您发现无法转换或转换失败,存在较大diff等问题,欢迎通过[ISSUE反馈](https://github.com/PaddlePaddle/X2Paddle/issues/new)的方式告知我们(模型名,代码实现或模型获取方式),我们会及时跟进: +**注:** 受限于不同框架的差异,部分预测模型可能会存在目前无法转换的情况,如TensorFlow中包含控制流的模型等。对于常见的预测模型或PyTorch项目,如若您发现无法转换或转换失败,存在较大diff等问题,欢迎通过[ISSUE反馈](https://github.com/PaddlePaddle/X2Paddle/issues/new)的方式告知我们(模型名,代码实现或模型获取方式),我们会及时跟进。 diff --git a/docs/pytorch_project_convertor/API_docs/README.md b/docs/pytorch_project_convertor/API_docs/README.md index de77107b096d6549f9c71b264b99311604814adc..4a3c4b9a4f9195ce28403e9c087326115d3bed80 100644 --- a/docs/pytorch_project_convertor/API_docs/README.md +++ b/docs/pytorch_project_convertor/API_docs/README.md @@ -1,15 +1,9 @@ # PyTorch-PaddlePaddle API对应表 本文档梳理了常用PyTorch 1.8.1 API与PaddlePaddle 2.0.0 API对应关系和差异分析。根据文档对应关系,有PyTorch使用经验的用户,可根据对应关系,快速熟悉PaddlePaddle的API使用。 - -## [基础操作类](./ops/README.md) - -## [组网类](./nn/README.md) - -## [Loss类](./loss/README.md) - -## [工具类](./utils/README.md) - -## [视觉类](./vision/README.md) - - -***持续更新...*** +| 类别 | 链接 | +| ---------- | ------------------------- | +| 基础操作类 | [映射表](./ops/README.md) | +| 组网类 | [映射表](./nn/README.md) | +| Loss类 |[映射表](./loss/README.md) | +| 工具类 | [映射表](./utils/README.md) | +| 视觉类 | [映射表](./vision/README.md) | diff --git a/docs/pytorch_project_convertor/API_docs/loss/README.md b/docs/pytorch_project_convertor/API_docs/loss/README.md index 7839364e5097770de4d5eca0430fd102f4e6c16c..8cf8099e88e7e4ef6bd214b53710ec4072ce0b61 100644 --- a/docs/pytorch_project_convertor/API_docs/loss/README.md +++ b/docs/pytorch_project_convertor/API_docs/loss/README.md @@ -1,4 +1,5 @@ -***持续更新...***## Loss类 +## Loss类API映射列表 +该文档梳理了计算loss相关的PyTorch-PaddlePaddle API映射列表。 | 序号 | PyTorch API | PaddlePaddle API | 备注 | | ---- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | 1 | [torch.nn.L1Loss](https://pytorch.org/docs/stable/generated/torch.nn.L1Loss.html?highlight=l1loss#torch.nn.L1Loss) | [paddle.nn.loss.L1Loss](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/layer/loss/L1Loss_cn.html#l1loss) | 功能一致,PyTroch存在废弃参数`size_average`和`reduce`。 | diff --git a/docs/pytorch_project_convertor/API_docs/nn/README.md b/docs/pytorch_project_convertor/API_docs/nn/README.md index 0d11bec42bf80e9edcc254b9d632ce42ec6db3e1..1e9f0368f24d72a968db6441bb8fc215d5f263f6 100644 --- a/docs/pytorch_project_convertor/API_docs/nn/README.md +++ b/docs/pytorch_project_convertor/API_docs/nn/README.md @@ -1,4 +1,6 @@ -## 组网类 +## 组网类API映射列表 + +该文档梳理了与构造网络相关的PyTorch-PaddlePaddle API映射列表。 | 序号 | PyTorch API | PaddlePaddle API | 备注 | | ---- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | diff --git a/docs/pytorch_project_convertor/API_docs/ops/README.md b/docs/pytorch_project_convertor/API_docs/ops/README.md index fd8374d21365f283c50bd8ad15e65d92f613b18a..38c9638cbe432a74f87a84b830d1f75182021221 100644 --- a/docs/pytorch_project_convertor/API_docs/ops/README.md +++ b/docs/pytorch_project_convertor/API_docs/ops/README.md @@ -1,4 +1,5 @@ -## PyTorch-PaddlePaddle 基础操作类API对应表 +## 基础操作类API映射列表 +该文档梳理了基础操作的PyTorch-PaddlePaddle API映射列表,主要包括了构造Tensor、数学计算、逻辑计算相关的API。 | 序号 | PyTorch API | PaddlePaddle API | 备注 | | ---- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | diff --git a/docs/pytorch_project_convertor/API_docs/utils/README.md b/docs/pytorch_project_convertor/API_docs/utils/README.md index 4416ef62dfb76edd699d5f98655c5c46b0f28ad4..b89b50f8bcd5ce242a4daa09b749937f212c6160 100644 --- a/docs/pytorch_project_convertor/API_docs/utils/README.md +++ b/docs/pytorch_project_convertor/API_docs/utils/README.md @@ -1,4 +1,5 @@ -## 工具类 +## 工具类API映射列表 +该文档梳理了与数据处理、分布式处理等相关的PyTorch-PaddlePaddle API映射列表。 | 序号 | PyTorch API | PaddlePaddle API | 备注 | | ---- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | 1 | [torch.nn.DataParallel](https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html?highlight=dataparallel#torch.nn.DataParallel) | [paddle.DataParallel](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/fluid/dygraph/parallel/DataParallel_cn.html#dataparallel) | [差异对比](torch.nn.DataParallel.md) | diff --git a/docs/pytorch_project_convertor/API_docs/vision/README.md b/docs/pytorch_project_convertor/API_docs/vision/README.md index c7b9c2fe793766b69afbd884807a64a8fdd79073..d4ea5783af4fefdb85763d7a87e0280b4fbcc8b7 100644 --- a/docs/pytorch_project_convertor/API_docs/vision/README.md +++ b/docs/pytorch_project_convertor/API_docs/vision/README.md @@ -1,5 +1,6 @@ -## 视觉类 +## 视觉类API映射列表 +该文档梳理了与视觉处理相关的PyTorch-PaddlePaddle API映射列表。 | 序号 | PyTorch API | PaddlePaddle API | 备注 | | ---- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------- | | 1 | [torchvision.transforms.Compose](https://pytorch.org/vision/stable/transforms.html?highlight=compose#torchvision.transforms.Compose) | [paddle.vision.transforms.Compose](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/transforms/transforms/Compose_cn.html#compose) | 功能一致 | diff --git a/docs/pytorch_project_convertor/README.md b/docs/pytorch_project_convertor/README.md index a8a3b00add657bfb152d67ef8c39dbb3da82a32b..37e79a230f152ab2dcac13613ec65441b62e62a9 100644 --- a/docs/pytorch_project_convertor/README.md +++ b/docs/pytorch_project_convertor/README.md @@ -12,7 +12,7 @@ ``` shell x2paddle --convert_torch_project --project_dir=torch_project --save_dir=paddle_project --pretrain_model=model.pth ``` -| 参数 | | +| 参数 | 作用| |----------|--------------| |--convert_torch_project | 当前方式为对PyTorch Project进行转换 | |--project_dir | PyTorch的项目路径 | @@ -23,4 +23,4 @@ x2paddle --convert_torch_project --project_dir=torch_project --save_dir=paddle_p ### 第三步:转换后代码后处理 PaddlePaddle在使用上有部分限制(例如:自定义Dataset必须继承自`paddle.io.Dataset`、部分情况下DataLoader的num_worker只能为0等),用户需要手动修改代码,使代码运行,具体可参见[转换后代码后处理](./after_convert.md)。 -***[注意]*** 转换前后相应操作可以参考[转换示例](./demo.md) +***[注意]*** 转换前后相应操作可以参考[转换示例](./demo/README.md) diff --git a/docs/pytorch_project_convertor/demo/README.md b/docs/pytorch_project_convertor/demo/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f8092a0f4678e23e9dd7b655dc8710ff19ec3e25 --- /dev/null +++ b/docs/pytorch_project_convertor/demo/README.md @@ -0,0 +1,9 @@ +# PyTorch项目转换教程 + + +| 模型 | 转换教程| 转换前代码 | 转换后代码 | +|------|-----|----------|------| +| StaGAN | [demo](stargan.md)| [code](https://github.com/yunjey/stargan)|[code](https://github.com/SunAhong1993/stargan/tree/paddle)| +| Ultra-Light-Fast-Generic-Face-Detector |[demo](ultra_light_fast_generic_face_detector.md)| [code](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) |[code](https://github.com/SunAhong1993/Ultra-Light-Fast-Generic-Face-Detector-1MB/tree/paddle)| + +***持续更新...*** diff --git a/docs/pytorch_project_convertor/demo.md b/docs/pytorch_project_convertor/demo/stargan.md similarity index 53% rename from docs/pytorch_project_convertor/demo.md rename to docs/pytorch_project_convertor/demo/stargan.md index f675a869d5025e900db2a1f336b175b073dbd845..92d4151561c4ddc5d5c087f0914cf6f3d7a25ab4 100644 --- a/docs/pytorch_project_convertor/demo.md +++ b/docs/pytorch_project_convertor/demo/stargan.md @@ -1,4 +1,3 @@ -# PyTorch项目转换示例 ## [StarGAN](https://github.com/yunjey/stargan) ### 准备工作 ``` shell @@ -105,93 +104,3 @@ python main.py --mode train --dataset CelebA --image_size 128 --c_dim 5 --sample ``` ***转换后的代码可在[这里](https://github.com/SunAhong1993/stargan/tree/paddle)进行查看。*** - -## [Ultra-Light-Fast-Generic-Face-Detector](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) - -### 准备工作 -1. 下载项目 -``` shell -# 下载项目 -git clone https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB.git -git checkout 492a02471671b49c56be8d90cda54c94749d2980 -``` -2. 根据Generate VOC format training data set and training process的README.md所示下载数据集,并存放于Ultra-Light-Fast-Generic-Face-Detector-1MB/data/文件夹下。 -### 第一步:转换前代码预处理 -1. 将代码中的[或操作符](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/master/vision/utils/box_utils.py#L153)替换为如下代码: -``` python -... -def hard_negative_mining(loss, labels, neg_pos_ratio): - ... - # return pos_mask | neg_mask - return torch.bitwise_or(pos_mask, neg_mask) -... -``` - -2. 使自定义的[`DataSet`](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/master/vision/datasets/voc_dataset.py#L10)继承`torch.utils.data.Dataset`,同时由于代码未导入torch,要添加相关导入的包,修改为如下代码: -``` python -... -# 导入torch -import torch -... -# class VOCDataset -class VOCDataset(torch.utils.data.Dataset): - ... -... -``` -3. 将[数据预处理](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/master/vision/utils/box_utils.py#L126)Tensor与int型对比,修改为Tensor与Tensor对比,修改如下: -``` python -... -def assign_priors(gt_boxes, gt_labels, corner_form_priors, - iou_threshold): - ... - # labels[best_target_per_prior < iou_threshold] = 0 # the backgournd id - # 将原来的赋值修改为7-8行 - iou_threshold_tensor = torch.full_like(best_target_per_prior, iou_threshold) - labels[best_target_per_prior < iou_threshold_tensor] = 0 - boxes = gt_boxes[best_target_per_prior_index] - return boxes, labels -... -``` - -### 第二步:转换 -```shell -x2paddle --convert_torch_project --project_dir=Ultra-Light-Fast-Generic-Face-Detector-1MB --save_dir=paddle_project -``` -### 第三步:转换后代码后处理 -**需要修改的文件位于paddle_project文件夹中,其中文件命名与原始Ultra-Light-Fast-Generic-Face-Detector-1MB文件夹中文件命名一致。** -1. DataLoader的`num_workers`设置为0,在转换后的[train-version-RFB.sh处](https://github.com/SunAhong1993/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/paddle/train-version-RFB.sh#L27)设置强制设置`num_workers`,具体添加代码如下: -```shell -... - --num_workers \ - #4 \ - 0 \ -... -``` -2.修改自定义Dataset中的[\_\_getitem\_\_的返回值](https://github.com/SunAhong1993/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/paddle/vision/datasets/voc_dataset.py#L56),将Tensor修改为numpy,修改代码如下: -``` python -... -class VOCDataset(data.Dataset): - ... - def __getitem__(self, index): - image_id = self.ids[index] - boxes, labels, is_difficult = self._get_annotation(image_id) - if not self.keep_difficult: - boxes = boxes[is_difficult == 0] - labels = labels[is_difficult == 0] - image = self._read_image(image_id) - if self.transform: - image, boxes, labels = self.transform(image, boxes, labels) - if self.target_transform: - boxes, labels = self.target_transform(boxes, labels) - # return image, boxes, labels - # 将原来的return替换为如下17行 - return image.numpy(), boxes.numpy(), labels.numpy() - ... -``` - -### 运行训练代码 -``` shell -cd paddle_project/Ultra-Light-Fast-Generic-Face-Detector-1MB -sh train-version-RFB.sh -``` -***转换后的代码可在[这里](https://github.com/SunAhong1993/Ultra-Light-Fast-Generic-Face-Detector-1MB/tree/paddle)进行查看。*** diff --git a/docs/pytorch_project_convertor/demo/ultra_light_fast_generic_face_detector.md b/docs/pytorch_project_convertor/demo/ultra_light_fast_generic_face_detector.md new file mode 100644 index 0000000000000000000000000000000000000000..dc5830e2ac877322b727fdb1c60369c2c3e5bd97 --- /dev/null +++ b/docs/pytorch_project_convertor/demo/ultra_light_fast_generic_face_detector.md @@ -0,0 +1,89 @@ +## [Ultra-Light-Fast-Generic-Face-Detector](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB) + +### 准备工作 +1. 下载项目 +``` shell +# 下载项目 +git clone https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB.git +git checkout 492a02471671b49c56be8d90cda54c94749d2980 +``` +2. 根据Generate VOC format training data set and training process的README.md所示下载数据集,并存放于Ultra-Light-Fast-Generic-Face-Detector-1MB/data/文件夹下。 +### 第一步:转换前代码预处理 +1. 将代码中的[或操作符](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/master/vision/utils/box_utils.py#L153)替换为如下代码: +``` python +... +def hard_negative_mining(loss, labels, neg_pos_ratio): + ... + # return pos_mask | neg_mask + return torch.bitwise_or(pos_mask, neg_mask) +... +``` + +2. 使自定义的[`DataSet`](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/master/vision/datasets/voc_dataset.py#L10)继承`torch.utils.data.Dataset`,同时由于代码未导入torch,要添加相关导入的包,修改为如下代码: +``` python +... +# 导入torch +import torch +... +# class VOCDataset +class VOCDataset(torch.utils.data.Dataset): + ... +... +``` +3. 将[数据预处理](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/master/vision/utils/box_utils.py#L126)Tensor与int型对比,修改为Tensor与Tensor对比,修改如下: +``` python +... +def assign_priors(gt_boxes, gt_labels, corner_form_priors, + iou_threshold): + ... + # labels[best_target_per_prior < iou_threshold] = 0 # the backgournd id + # 将原来的赋值修改为7-8行 + iou_threshold_tensor = torch.full_like(best_target_per_prior, iou_threshold) + labels[best_target_per_prior < iou_threshold_tensor] = 0 + boxes = gt_boxes[best_target_per_prior_index] + return boxes, labels +... +``` + +### 第二步:转换 +```shell +x2paddle --convert_torch_project --project_dir=Ultra-Light-Fast-Generic-Face-Detector-1MB --save_dir=paddle_project +``` +### 第三步:转换后代码后处理 +**需要修改的文件位于paddle_project文件夹中,其中文件命名与原始Ultra-Light-Fast-Generic-Face-Detector-1MB文件夹中文件命名一致。** +1. DataLoader的`num_workers`设置为0,在转换后的[train-version-RFB.sh处](https://github.com/SunAhong1993/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/paddle/train-version-RFB.sh#L27)设置强制设置`num_workers`,具体添加代码如下: +```shell +... + --num_workers \ + #4 \ + 0 \ +... +``` +2.修改自定义Dataset中的[\_\_getitem\_\_的返回值](https://github.com/SunAhong1993/Ultra-Light-Fast-Generic-Face-Detector-1MB/blob/paddle/vision/datasets/voc_dataset.py#L56),将Tensor修改为numpy,修改代码如下: +``` python +... +class VOCDataset(data.Dataset): + ... + def __getitem__(self, index): + image_id = self.ids[index] + boxes, labels, is_difficult = self._get_annotation(image_id) + if not self.keep_difficult: + boxes = boxes[is_difficult == 0] + labels = labels[is_difficult == 0] + image = self._read_image(image_id) + if self.transform: + image, boxes, labels = self.transform(image, boxes, labels) + if self.target_transform: + boxes, labels = self.target_transform(boxes, labels) + # return image, boxes, labels + # 将原来的return替换为如下17行 + return image.numpy(), boxes.numpy(), labels.numpy() + ... +``` + +### 运行训练代码 +``` shell +cd paddle_project/Ultra-Light-Fast-Generic-Face-Detector-1MB +sh train-version-RFB.sh +``` +***转换后的代码可在[这里](https://github.com/SunAhong1993/Ultra-Light-Fast-Generic-Face-Detector-1MB/tree/paddle)进行查看。*** diff --git a/docs/pytorch_project_convertor/supported_API.md b/docs/pytorch_project_convertor/supported_API.md index 6bfb2f71dbfec6af48839eb264b8002ab39b3d73..3ecfb747b4cf3a9afc89b707d09b3c4a184631c3 100644 --- a/docs/pytorch_project_convertor/supported_API.md +++ b/docs/pytorch_project_convertor/supported_API.md @@ -1,5 +1,5 @@ # PyTorch训练项目转换支持API列表 -> 目前PyTorch训练项目转换支持6个优化器相关API,40+的NN类API,5个Utils类API,2个Autograd类API,40+的基础操作API以及10+Torchvision API,我们在如下列表中给出了目前的全部API。 +> 目前PyTorch训练项目转换支持6个优化器相关API,70+的NN类API,10+Utils类API,2个Autograd类API,40+的基础操作API以及30+Torchvision API,我们在如下列表中给出了目前的全部API。 ## 优化器相关API | 序号 | API | 序号 | API | @@ -35,7 +35,22 @@ | 41 | torch.nn.functional.softmax | 42 | torch.nn.init.xavier_uniform_ | | 43 | torch.nn.functional.binary_cross_entropy_with_logits | 44 | torch.nn.functional.cross_entropy | | 45 | torch.nn.functional.dropout | 46 | torch.nn.functional.relu | -| 47 | torch.nn.functional.smooth_l1_loss | | | +| 47 | torch.nn.functional.smooth_l1_loss | 48 | torch.nn.AdaptiveAvgPool1d | +| 49 | torch.nn.AdaptiveAvgPool2d | 50 | torch.nn.AdaptiveAvgPool3d | +| 51 | torch.nn.AvgPool1d | 52 | torch.nn.AvgPool2d | +| 53 | torch.nn.AvgPool3d | 54 | torch.nn.ConstantPad2d | +| 55 | torch.nn.Dropout2d | 56 | torch.nn.GELU | +| 57 | torch.nn.GroupNorm | 58 | torch.nn.Identity | +| 59 | torch.nn.LayerNorm | 60 | torch.nn.MaxUnpool2d | +| 61 | torch.nn.ReflectionPad2d | 62 | torch.nn.ReplicationPad2d | +| 63 | torch.nn.PReLU | 64 | torch.nn.SyncBatchNorm | +| 65 | torch.nn.ZeroPad2d | 66 | torch.nn.KLDivLoss | +| 67 | torch.nn.L1Loss | 68 | paddle.nn.functional.interpolate | +| 69 | torch.nn.functional.mse_loss | 70 | torch.nn.init.constant_ | +| 71 | torch.nn.init.normal_ | 72 | torch.nn.init.ones_ | +| 73 | torch.nn.init.zeros_ | 74 | torch.nn.init.orthogonal_ | + + ## Utils类API @@ -43,7 +58,11 @@ | ---- | ------------------------------ | ---- | --------------------------- | | 1 | torch.utils.data | 2 | torch.utils.data.DataLoader | | 3 | torch.utils.data.random_split | 4 | torch.utils.data.Dataset | -| 5 | torch.utils.data.ConcatDataset | | | +| 5 | torch.utils.data.ConcatDataset | 6 | torch.utils.data.distributed | +| 7 | torch.utils.data.distributed.DistributedSampler | 8 | torch.utils.model_zoo | +| 9 | torch.utils.model_zoo.load_url | 10 | torch.multiprocessing | +| 11 | torch.multiprocessing.spawn | 12 | torch.distributed | +| 13 | torch.distributed.init_process_group | 14 | | ## Autograd类API @@ -76,6 +95,9 @@ | 37 | torch.rand | 38 | torch.abs | | 39 | torch.bitwise_or | 40 | torch.bitwise_xor | | 41 | torch.bitwise_and | 42 | torch.bitwise_not | +| 43 | torch.randn | 44 | torch.add | +| 45 | torch.mul | 46 | torch.linspace | +| 47 | torch.einsum| | | ## Torchvision API @@ -86,5 +108,18 @@ | 5 | torchvision.transforms.ToTensor | 6 | torchvision.transforms.RandomHorizontalFlip | | 7 | torchvision.transforms.CenterCrop | 8 | torchvision.transforms.Normalize | | 9 | torchvision.utils.save_image | 10 | torchvision.datasets.ImageFolder | +| 11 | torchvision.transforms.RandomResizedCrop | 12 | torchvision.transforms.Lambda | +| 13 | torchvision.utils | 14 | torchvision.utils.save_image | +| 15 | torchvision.datasets | 16 | torchvision.datasets.ImageFolder | +| 17 | torchvision.models | 18 | torchvision.models.vgg_pth_urls | +| 19 | torchvision.models.vgg11 | 20 | torchvision.models.vgg13 | +| 21 | torchvision.models.vgg16 | 22 | torchvision.models.vgg19 | +| 23 | torchvision.models.vgg11_bn | 24 | torchvision.models.vgg13_bn | +| 25 | torchvision.models.vgg16_bn | 26 | torchvision.models.vgg19_bn | +| 27 | torchvision.models.resnet34 | 28 | torchvision.models.resnet50 | +| 29 | torchvision.models.resnet101 | 30 | torchvision.models.resnet152 | +| 31 | torchvision.models.resnext50_32x4d | 32 | torchvision.models.resnext101_32x8d | +| 33 | torchvision.models.wide_resnet50_2 | 34 | torchvision.models.wide_resnet101_2 | + ***持续更新...***