Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tensor half #7971

Merged
merged 36 commits into from
Apr 22, 2022
Merged

add tensor half #7971

merged 36 commits into from
Apr 22, 2022

Conversation

zhongshsh
Copy link
Contributor

@zhongshsh zhongshsh commented Apr 7, 2022

添加 oneflow.Tensor.half,与 torch.Tensor.half 对齐。

image

@CLAassistant
Copy link

CLAassistant commented Apr 7, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Contributor

Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally.

@BBuf BBuf requested review from oneflow-ci-bot and removed request for oneflow-ci-bot April 11, 2022 05:39
@github-actions
Copy link
Contributor

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/7971/

@BBuf BBuf changed the base branch from master to add_module_half April 20, 2022 03:10
@BBuf BBuf changed the base branch from add_module_half to master April 20, 2022 03:10
@BBuf BBuf changed the base branch from master to add_module_half April 20, 2022 03:13
@BBuf BBuf changed the base branch from add_module_half to master April 20, 2022 03:14
@zhongshsh zhongshsh requested review from oneflow-ci-bot and removed request for oneflow-ci-bot April 20, 2022 05:08
@github-actions
Copy link
Contributor

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/7971/

@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

❌ OneFlow resnet50 time: 129.1ms (= 12914.8ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 150.1ms (= 15005.2ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.16 (= 150.1ms / 129.1ms)

OneFlow resnet50 time: 81.3ms (= 8126.7ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 86.4ms (= 8643.2ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.06 (= 86.4ms / 81.3ms)

OneFlow resnet50 time: 55.2ms (= 11047.4ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 62.1ms (= 12410.3ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.12 (= 62.1ms / 55.2ms)

OneFlow resnet50 time: 45.6ms (= 9114.2ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 46.2ms (= 9243.0ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.01 (= 46.2ms / 45.6ms)

OneFlow resnet50 time: 41.2ms (= 8244.3ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 36.0ms (= 7194.9ms / 200, input_shape=[1, 3, 224, 224])
❌ Relative speed: 0.87 (= 36.0ms / 41.2ms)

OneFlow swin dataloader time: 0.261s (= 52.250s / 200, num_workers=1)
PyTorch swin dataloader time: 0.149s (= 29.811s / 200, num_workers=1)
Relative speed: 0.571 (= 0.149s / 0.261s)

OneFlow swin dataloader time: 0.068s (= 13.617s / 200, num_workers=4)
PyTorch swin dataloader time: 0.041s (= 8.157s / 200, num_workers=4)
Relative speed: 0.599 (= 0.041s / 0.068s)

OneFlow swin dataloader time: 0.037s (= 7.378s / 200, num_workers=8)
PyTorch swin dataloader time: 0.022s (= 4.450s / 200, num_workers=8)
Relative speed: 0.603 (= 0.022s / 0.037s)

❌ OneFlow resnet50 time: 136.7ms (= 13671.2ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 163.8ms (= 16380.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.20 (= 163.8ms / 136.7ms)

OneFlow resnet50 time: 93.5ms (= 9353.4ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 103.8ms (= 10378.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.11 (= 103.8ms / 93.5ms)

OneFlow resnet50 time: 64.7ms (= 12930.5ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 79.2ms (= 15833.9ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.22 (= 79.2ms / 64.7ms)

OneFlow resnet50 time: 53.5ms (= 10693.7ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 65.9ms (= 13186.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.23 (= 65.9ms / 53.5ms)

OneFlow resnet50 time: 50.3ms (= 10057.5ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 68.1ms (= 13617.6ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.35 (= 68.1ms / 50.3ms)

@zhongshsh zhongshsh enabled auto-merge (squash) April 21, 2022 01:11
@zhongshsh zhongshsh requested review from oneflow-ci-bot and removed request for oneflow-ci-bot April 21, 2022 06:15
@github-actions
Copy link
Contributor

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/7971/

@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

✔️ OneFlow resnet50 time: 129.0ms (= 12902.0ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 144.7ms (= 14469.8ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.12 (= 144.7ms / 129.0ms)

OneFlow resnet50 time: 84.4ms (= 8435.0ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 87.9ms (= 8789.5ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.04 (= 87.9ms / 84.4ms)

OneFlow resnet50 time: 55.7ms (= 11142.0ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 61.9ms (= 12384.8ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.11 (= 61.9ms / 55.7ms)

OneFlow resnet50 time: 47.4ms (= 9477.5ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 43.3ms (= 8664.5ms / 200, input_shape=[2, 3, 224, 224])
❌ Relative speed: 0.91 (= 43.3ms / 47.4ms)

OneFlow resnet50 time: 38.8ms (= 7762.6ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 38.0ms (= 7608.6ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 0.98 (= 38.0ms / 38.8ms)

OneFlow swin dataloader time: 0.255s (= 51.057s / 200, num_workers=1)
PyTorch swin dataloader time: 0.151s (= 30.231s / 200, num_workers=1)
Relative speed: 0.592 (= 0.151s / 0.255s)

OneFlow swin dataloader time: 0.070s (= 14.076s / 200, num_workers=4)
PyTorch swin dataloader time: 0.044s (= 8.726s / 200, num_workers=4)
Relative speed: 0.620 (= 0.044s / 0.070s)

OneFlow swin dataloader time: 0.037s (= 7.358s / 200, num_workers=8)
PyTorch swin dataloader time: 0.023s (= 4.506s / 200, num_workers=8)
Relative speed: 0.612 (= 0.023s / 0.037s)

✔️ OneFlow resnet50 time: 136.3ms (= 13634.2ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 164.7ms (= 16472.1ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.21 (= 164.7ms / 136.3ms)

OneFlow resnet50 time: 93.6ms (= 9359.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 103.6ms (= 10360.6ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.11 (= 103.6ms / 93.6ms)

OneFlow resnet50 time: 64.9ms (= 12984.2ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 88.9ms (= 17785.0ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.37 (= 88.9ms / 64.9ms)

OneFlow resnet50 time: 54.7ms (= 10932.3ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 72.4ms (= 14485.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.32 (= 72.4ms / 54.7ms)

OneFlow resnet50 time: 51.5ms (= 10296.0ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 76.8ms (= 15364.5ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.49 (= 76.8ms / 51.5ms)

@github-actions
Copy link
Contributor

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/7971/

@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

✔️ OneFlow resnet50 time: 128.6ms (= 12859.7ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 142.3ms (= 14228.4ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.11 (= 142.3ms / 128.6ms)

OneFlow resnet50 time: 77.9ms (= 7791.5ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 83.5ms (= 8352.2ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.07 (= 83.5ms / 77.9ms)

OneFlow resnet50 time: 53.0ms (= 10606.5ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 54.0ms (= 10808.2ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.02 (= 54.0ms / 53.0ms)

OneFlow resnet50 time: 43.9ms (= 8787.9ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 40.9ms (= 8187.0ms / 200, input_shape=[2, 3, 224, 224])
❌ Relative speed: 0.93 (= 40.9ms / 43.9ms)

OneFlow resnet50 time: 40.2ms (= 8042.9ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 38.5ms (= 7693.5ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 0.96 (= 38.5ms / 40.2ms)

OneFlow swin dataloader time: 0.264s (= 52.806s / 200, num_workers=1)
PyTorch swin dataloader time: 0.153s (= 30.543s / 200, num_workers=1)
Relative speed: 0.578 (= 0.153s / 0.264s)

OneFlow swin dataloader time: 0.069s (= 13.833s / 200, num_workers=4)
PyTorch swin dataloader time: 0.042s (= 8.452s / 200, num_workers=4)
Relative speed: 0.611 (= 0.042s / 0.069s)

OneFlow swin dataloader time: 0.037s (= 7.500s / 200, num_workers=8)
PyTorch swin dataloader time: 0.023s (= 4.582s / 200, num_workers=8)
Relative speed: 0.611 (= 0.023s / 0.037s)

❌ OneFlow resnet50 time: 138.5ms (= 13845.4ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 162.6ms (= 16258.5ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.17 (= 162.6ms / 138.5ms)

OneFlow resnet50 time: 92.3ms (= 9232.1ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 102.8ms (= 10277.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.11 (= 102.8ms / 92.3ms)

OneFlow resnet50 time: 63.7ms (= 12731.5ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 77.3ms (= 15459.2ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.21 (= 77.3ms / 63.7ms)

OneFlow resnet50 time: 56.2ms (= 11241.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 81.3ms (= 16251.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.45 (= 81.3ms / 56.2ms)

OneFlow resnet50 time: 51.2ms (= 10237.2ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 67.3ms (= 13457.3ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.31 (= 67.3ms / 51.2ms)

@zhongshsh zhongshsh merged commit 58e94af into master Apr 22, 2022
@zhongshsh zhongshsh deleted the add_tensor_half branch April 22, 2022 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants