torch-ms-adapter
torch-ms-adapter 是一个在 MindSpore 上模拟 PyTorch API 的适配器库。
目标是让你几乎无需修改 PyTorch 代码,就能在 MindSpore 上运行。
特性
- 支持 nn.Module, Conv2d, Linear, ReLU, CrossEntropyLoss
- 封装了 DataLoader 和 Trainer(底层使用 MindSpore)
- 提供 torch.nn.functional 基本操作
- 自动屏蔽 PyTorch,兼容原始导入语句
安装
pip install torch-ms-adapter
使用示例
import torch_ms_adapter as torch
import torch_ms_adapter.nn as nn
import torch_ms_adapter.functional as F
class LeNet5(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 6, 5)
self.fc1 = nn.Linear(16*4*4, 120)
self.fc2 = nn.Linear(120, 10)
def forward(self, x):
x = F.relu(self.conv1(x))
x = torch.flatten(x, 1)
x = self.fc2(F.relu(self.fc1(x)))
return x
运行方式与pytorch一致,只需替换
import torch
为
import torch_ms_adapter as torch
路线图
- 支持基础层(linear,Conv2d,ReLU)
- 支持Loss函数
- 封装Optimizer
- 支持更多PyTorch模块(YOLO,ResNet)
- 完善Autograd
贡献
欢迎提交issue和PR,一起完善torch-ms-adopter
Metadata
Release files for torch-ms-adapter 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| torch_ms_adapter-0.1.4.tar.gz | 6.7 kB | Without provenance | Details for torch_ms_adapter-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torch_ms_adapter-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for torch_ms_adapter-0.1.4-py3-none-any.whl |
Total release size: 14.4 kB
Release files / torch_ms_adapter-0.1.4.tar.gz
| Download URL | torch_ms_adapter-0.1.4.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b29c9e82c3e3ce8881f06f22a0cca08e674345bffa7186894bb97c40f981ad5b
|
|
BLAKE2b-256 checksum How to use checksums |
4a0f687071bc9be06362e936bedd9c559c7fdef277b9c3eda098dc7373060cd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / torch_ms_adapter-0.1.4-py3-none-any.whl
| Download URL | torch_ms_adapter-0.1.4-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bb086157f02156a22025282853005b591dbbe02b4ac6cdbcf8c35019d5ac2aa
|
|
BLAKE2b-256 checksum How to use checksums |
fbca7bddfa9a316d678563beaef421b043148d5e4a6b193d18cff3d615fdf799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Security for torch-ms-adapter 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.