<p dir="auto">A example.</p>
<p dir="auto">In my computer output.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="4.814477205276489
0.03499555587768555"><pre class="notranslate"><code class="notranslate">4.814477205276489
0.03499555587768555
</code></pre></div>
<p dir="auto">code</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import torch
import numpy as np
import time

a = [np.random.random([512, 512, 3]).astype(np.float32) for i in range(10)]

t1 = time.time()
b = torch.tensor(a, dtype=torch.float32)
t2 = time.time()

c = torch.tensor(np.array(a), dtype=torch.float32)
t3 = time.time()

print(t2-t1)
print(t3-t2)
"><pre class="notranslate"><code class="notranslate">import torch
import numpy as np
import time

a = [np.random.random([512, 512, 3]).astype(np.float32) for i in range(10)]

t1 = time.time()
b = torch.tensor(a, dtype=torch.float32)
t2 = time.time()

c = torch.tensor(np.array(a), dtype=torch.float32)
t3 = time.time()

print(t2-t1)
print(t3-t2)

</code></pre></div>
<p dir="auto">I just started learning PyTorch, but it is puzzling that neither Pycharm nor VS Code can automatically complete the code for some functions, such as torch.empty(), torch.zeros(), etc.<br>
Can you give me some advice?<br>
Thanks~ o(<em>￣︶￣</em>)o</p>