Solved by tom in post #4 
              
              
                I think you need to put it in the global namespace (or at least that is a feasible workaround): 
import torch
import torch.utils.cpp_extension

cpp_source = """
#include <torch/extension.h>

torch::Tensor base_forward(torch::Tensor x, torch::Tensor w, torch::Tensor b){
    auto o = w * x + b;
    re…