Pytorch custom linear function. Improve this question.