I tried, it ran successfully. I also tried to replace LinearFunction.apply(input, self.weight, self.bias)  in forward function with input.matmul(self.weight.t()) + self.bias, it also worked. I think there is still something wrong with my implementation for customized_linear function, but I cannot find the mistake.