1.
imgL = np.reshape(imgL,[1,3,imgL.shape[1],imgL.shape[2]])
imgR = np.reshape(imgR,[1,3,imgR.shape[1],imgR.shape[2]])
print('size0=%d' %(imgL.shape[0]))
print('size1=%d' %(imgL.shape[1]))
print('size2=%d' %(imgL.shape[2]))
print('size3=%d' %(imgL.shape[3]))
size0=1
size1=3
size2=375
size3=1242
print('test size0=%d' %(imgL.shape[0]))
print('test size1=%d' %(imgL.shape[1]))
print('test size2=%d' %(imgL.shape[2]))
print('test size3=%d' %(imgL.shape[3]))
pred_disp = test(imgL,imgR)
test size0=1
test size1=3
test size2=384
test size3=1248
imgL22 = np.reshape(imgL,[imgL.shape[2],imgL.shape[3],3])
skimage.io.imsave('/b/left14444.jpg',(imgL22*256).astype('uint16'))
2.
# if args.cuda:
# imgL = torch.FloatTensor(imgL).cuda()
# imgR = torch.FloatTensor(imgR).cuda()
imgL = torch.FloatTensor(imgL)# add
imgR = torch.FloatTensor(imgR)# add
imgL, imgR= Variable(imgL), Variable(imgR)
测试可以通过
新的问题:
cost = Variable(torch.FloatTensor(refimg_fea.size()[0], refimg_fea.size()[1]*2, self.maxdisp/4, refimg_fea.size()[2], refimg_fea.size()[3]).zero_(), volatile= not self.training).cuda()
RuntimeError: Cannot initialize CUDA without ATen_cuda library. PyTorch splits its backend into two shared libraries: a CPU library and a CUDA library; this error has occurred because you are trying to use some CUDA functionality, but the CUDA library has not been loaded by the dynamic linker for some reason. The CUDA library MUST be loaded, EVEN IF you don't directly use any symbols from the CUDA library! One common culprit is a lack of -Wl,--no-as-needed in your link arguments; many dynamic linkers will delete dynamic library dependencies if you don't depend on any of their symbols. You can check if this has occurred by using ldd on your binary to see if there is a dependency on *_cuda.so library.