You should absolutely be able to use e.g. torch::Tensor instead of std::string for the method. Note that the “modern” way of extending PyTorch is CustomOperators 3 rather than “vanilla” C++ extensions.
Best regards
Thomas