1x1 컀λμ΄ μλ Conv2dλ CPUμμλ μ μλνμ§λ§ GPUμμλ μλνμ§ μμ΅λλ€.
net = nn.Conv2d(1, 6, kernel_size=(1,1))
net.cuda()
x = Variable(torch.randn(1, 1, 100, 100))
x.cuda()
net(x)
μλ¬ λ©μμ§:
TypeError: FloatSpatialConvolutionMM_updateOutput received an invalid combination of arguments - got (int, torch.FloatTensor, torch.FloatTensor, torch.cuda.FloatTensor, torch.cuda.FloatTensor, torch.FloatTensor, torch.FloatTensor, int, int, int, int, int, int), but expected (int state, torch.FloatTensor input, torch.FloatTensor output, torch.FloatTensor weight, [torch.FloatTensor bias or None], torch.FloatTensor finput, torch.FloatTensor fgradInput, int kW, int kH, int dW, int dH, int padW, int padH)
torch.backends.cudnn.enabled = False
cudnnμ λΉνμ±ννλ €κ³ μλνμ§λ§ μ¬μ ν λμΌν μ€λ₯ λ©μμ§κ° λνλ©λλ€.
Ubuntu 14.04, Cuda 7.5, Cudnn 5.1.5, Python 3.5.2λ₯Ό μ¬μ©νκ³ Pytorchλ λ°μ΄λ리μμ μ€μΉλ©λλ€.
convμ μ 곡λ μΈμ μ νμ μμΈν μ΄ν΄λ³΄λ©΄ μΌλΆ ν
μλ torch.cuda.FloatTensor
μ΄κ³ λλ¨Έμ§λ torch.FloatTensor
μμ μ μ μμ΅λλ€. GPUμ μ
λ ₯μ 보λ΄λ κ²μ μμμ κ²μ
λλ€.
λ€μ λμ μ λͺ νν νκΈ° μν΄:
x = Variable(torch.randn(1, 1, 100, 100))
x.cuda() # This creates a copy on the GPU and immediately discards it. "x" is still on the CPU
λ€μκ³Ό κ°μ΄ μμ±ν΄μΌ ν©λλ€.
x = Variable(torch.randn(1, 1, 100, 100).cuda())
νΌλμ νΌνκΈ° μν΄ model.cuda()
λ° x.cuda()
μΌκ΄λκ² λμνλλ‘ νλ κ²μ΄ λ λ«λ€κ³ μκ°ν©λλ€.
κ°μ₯ μ μ©ν λκΈ
λ€μ λμ μ λͺ νν νκΈ° μν΄:
λ€μκ³Ό κ°μ΄ μμ±ν΄μΌ ν©λλ€.