这有效
numpy.multiply(13, 3)
Run Code Online (Sandbox Code Playgroud)
事实并非如此
numpy.multiply(x1=13, x2=3)
Run Code Online (Sandbox Code Playgroud)
它提出了一个invalid number of arguments例外.有人可以解释为什么请.我试图按照文档进行操作,但是参数列表中包含的字符/和*字符有点丢失.如果您也可以解释这些含义,我们将不胜感激.
GPU在大约16秒内训练这个网络.CPU在大约13秒内完成.(我没有评论/评论适当的行来进行测试).谁能看到我的代码或pytorch安装有什么问题?(我已经检查过GPU是否可用,并且GPU上有足够的可用内存.
from os import path
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag())
accelerator = 'cu80' if path.exists('/opt/bin/nvidia-smi') else 'cpu'
print(accelerator)
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.4.0-{platform}-linux_x86_64.whl torchvision
print("done")
#########################
import torch
from datetime import datetime
startTime = datetime.now()
dtype = torch.float
device = torch.device("cpu") # Comment this to run on GPU
# device = torch.device("cuda:0") # Uncomment this to run on GPU
# N is batch size; D_in is input dimension;
# H is hidden dimension; D_out is …Run Code Online (Sandbox Code Playgroud)