Solved by singleroc in post #4 
              
              
                Hi,  I latter found the error is not related with cuda extension. It seemed to be the data type convert error when accessing the tensor. 
#include <ATen/ATen.h>
int cuda_dispatch(at::Tensor input, at::Tensor codec) {
  //void *ptr0 = codec.data<char>();  //this would casue the undefined error
  void…