Hi everyone, I am very new to neural networks and pytorch. I would like to train a model to take slope as an input, and give the corresponding line as an output. You might wonder why I wouldn’t just do this directly with the equation y=mx. The point is that I eventually want to use this same idea to make predictions for a highly non-linear function of an unknown form, but which is unique for different sets of parameters. Linear data is just the simplest example.

At any rate, I was thinking I could train a model on a bunch of linear data labeled with the slope, and then give the model a new slope and see how well it is able to make the corresponding line. I’m having a hard time figuring out how to do this with pytorch. The pytorch website has examples of image recognition, but the labels all correspond to discrete categories, whereas slope is a continuous variable. I have also looked at the examples for regression, but I’m struggling to see how to train something like that. It seems like the regression examples just try to fit a single function, but I want something that can *predict* a function.

So does anyone know how to do what I’m describing? I hope I am making myself clear. Thanks.