Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data type error using im2col #20

Open
kunrenzhilu opened this issue Apr 4, 2018 · 0 comments
Open

Data type error using im2col #20

kunrenzhilu opened this issue Apr 4, 2018 · 0 comments

Comments

@kunrenzhilu
Copy link

kunrenzhilu commented Apr 4, 2018

I use the follow code:

mat = np.repeat(np.repeat(np.arange(9).reshape(3,3), 3, axis=0), 3, axis=1).reshape(1,1,9,9)
mat2 = torch.from_numpy(mat)
P.im2col(Variable(mat2.cuda()), (3,3), (3,3), (0,0))

Then it throws error:

---------------------------------------------------------------------------
CompileException                          Traceback (most recent call last)
<ipython-input-29-8652fb792000> in <module>()
----> 1 P.im2col(Variable(mat2.cuda()), (3,3), (3,3), (0,0))

/home/haibin2/data/pytorch_env/local/lib/python2.7/site-packages/pyinn/im2col.py in im2col(input, kernel_size, stride, padding)
    244     TODO: add CPU version (via numpy?)
    245     """
--> 246     return Im2Col(kernel_size, stride, padding)(input)
    247 
    248 

/home/haibin2/data/pytorch_env/local/lib/python2.7/site-packages/pyinn/im2col.py in forward(self, input)
    207         assert(input.is_contiguous())
    208         self.input_size = input.size()[-2:]
--> 209         return im2col_batch(input, self.kernel_size, self.stride, self.padding)
    210 
    211     def backward(self, grad_output):

/home/haibin2/data/pytorch_env/local/lib/python2.7/site-packages/pyinn/im2col.py in im2col_batch(input, kernel_size, stride, padding)
    178 def im2col_batch(input, kernel_size, stride, padding):
    179     if input.dim() == 3:
--> 180         return _im2col(input, kernel_size, stride, padding)
    181     elif input.dim() == 4:
    182         shape = (input.size(0),) + im2col_shape(input.size()[1:], kernel_size, stride, padding)

/home/haibin2/data/pytorch_env/local/lib/python2.7/site-packages/pyinn/im2col.py in _im2col(data, kernel_size, stride, padding, out)
    118                         pad_h=pad_h, pad_w=pad_w,
    119                         stride_h=stride_h, stride_w=stride_w,
--> 120                         channels=n_input_plane)
    121         f(block=(CUDA_NUM_THREADS,1,1),
    122           grid=(GET_BLOCKS(n),1,1),

cupy/util.pyx in cupy.util.memoize.decorator.ret()

/home/haibin2/data/pytorch_env/local/lib/python2.7/site-packages/pyinn/utils.pyc in load_kernel(kernel_name, code, **kwargs)
     18 def load_kernel(kernel_name, code, **kwargs):
     19     code = Template(code).substitute(**kwargs)
---> 20     kernel_code = cupy.cuda.compile_with_cache(code)
     21     return kernel_code.get_function(kernel_name)

/home/haibin2/data/pytorch_env/local/lib/python2.7/site-packages/cupy/cuda/compiler.pyc in compile_with_cache(source, options, arch, cache_dir, extra_source)
    150                 return mod
    151 
--> 152     ptx = compile_using_nvrtc(source, options, arch)
    153     ls = function.LinkState()
    154     ls.add_ptr_data(ptx, six.u('cupy.ptx'))

/home/haibin2/data/pytorch_env/local/lib/python2.7/site-packages/cupy/cuda/compiler.pyc in compile_using_nvrtc(source, options, arch)
     68         prog = _NVRTCProgram(source, cu_path)
     69         try:
---> 70             ptx = prog.compile(options)
     71         except CompileException as e:
     72             dump = _get_bool_env_variable(

/home/haibin2/data/pytorch_env/local/lib/python2.7/site-packages/cupy/cuda/compiler.pyc in compile(self, options)
    231         except nvrtc.NVRTCError:
    232             log = nvrtc.getProgramLog(self.ptr)
--> 233             raise CompileException(log, self.src, self.name, options)
    234 
    235 

CompileException: /tmp/tmparMI_j/kern.cu(7): error: identifier "None" is undefined

/tmp/tmparMI_j/kern.cu(7): error: identifier "None" is undefined

2 errors detected in the compilation of "/tmp/tmparMI_j/kern.cu".

I don't understand what is going wrong, do you have any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant