-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Open
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixhas workaroundhigh prioritymodule: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operatorsmodule: performanceIssues related to performance, either of kernel code or framework glueIssues related to performance, either of kernel code or framework gluetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Bug
I compared the execution time of two codes.
Code 1:
import torch
import numpy as np
a = [np.random.randint(0, 10, size=(7, 7, 3)) for _ in range(100000)]
b = torch.tensor(np.array(a))
And code 2:
import torch
import numpy as np
a = [np.random.randint(0, 10, size=(7, 7, 3)) for _ in range(100000)]
b = torch.tensor(a)
The code 1 takes less than 1 second to execute (used time):
real 0m0,915s
user 0m0,808s
sys 0m0,330s
Whereas the code 2 takes 5 seconds:
real 0m6,057s
user 0m5,979s
sys 0m0,308s
Expected behavior
I would expect code 2 to be as fast as code 1.
Environment
- PyTorch 0.4.1
- Linux
- OS (e.g., Linux):
- Installed with
conda - Python version: 3.6
cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @mruberry @rgommers @heitorschueroff @VitalyFedyunin @ngimel
samedii, aerdem4, khoda81, FrancescoMandru, faridlazuarda and 6 more
Metadata
Metadata
Assignees
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixhas workaroundhigh prioritymodule: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operatorsmodule: performanceIssues related to performance, either of kernel code or framework glueIssues related to performance, either of kernel code or framework gluetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module