Convert Function to Custom Kernel

Convert Function to Custom Kernel