Extending torchscript a custom class in torch c++

How can I create a custom class in c++ and import the output in python? Riight now, the example given is:

torch::Tensor warp_perspective(torch::Tensor image, torch::Tensor warp) {
  cv::Mat image_mat(/*rows=*/image.size(0),
                    /*cols=*/image.size(1),
                    /*type=*/CV_32FC1,
                    /*data=*/image.data_ptr<float>());
  cv::Mat warp_mat(/*rows=*/warp.size(0),
                   /*cols=*/warp.size(1),
                   /*type=*/CV_32FC1,
                   /*data=*/warp.data_ptr<float>());
  cv::Mat output_mat;
  cv::warpPerspective(image_mat, output_mat, warp_mat, /*dsize=*/{8, 8});
  torch::Tensor output = torch::from_blob(output_mat.ptr<float>(), /*sizes=*/{8, 8});
  return output.clone();

}

TORCH_LIBRARY(my_ops, m) {
  m.def("warp_perspective", warp_perspective);
}

But suppose I want to create a class in c++, initialise the class and call a method from that in python, like:

Class imageTransform()
{

     initialise()
        {
               /////initialise some values
         }

     torch::Tensor warp_perspective () {
               ////use the initialised value here
               ////here do the transform and return the tensor
        }
}

How can I write the python binding for this case?

@Kumar_Govindam
Please take a look at this:
https://pytorch.org/tutorials/advanced/cpp_extension.html
You can create a cpp extension module and bind your own functions. You can not define a real c++ class, but this is similar, you have a module name and functions under the module, the only thing is that you have no constructor.

Actually I have tried those things, and its kind of working after some modifications, but its generating
.so file like classifier.cpython-37m-x86_64-linux-gnu.so, instead of classifier.so. So, wanted to know if there is a cleaner way to do that. Anyway thanks for the reply.