About the number of Input

I have defined my Net with 1 input and 1 out,but trained with 100 inputs, now How can I use 1 input to get 1 output

Based on your model description, your input should have the dimensions [batch_size, 1].
Your output will therefore have the same dims. Each sample has only one feature and the model outputs one prediction for each sample.
If you would like to pass only one sample, you could call model(x[0]).

What means call model(x[0]), can you show me a example?

Here is a small example:

class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.hidden = nn.Linear(1, 10)
        self.predict = nn.Linear(10, 1)
    def forward(self, x):
        x = F.relu(self.hidden(x))
        x = self.predict(x)
        return x

model = MyModel()

batch_size = 10
x = torch.randn(batch_size, 1)

output = model(x)
> torch.Size([10, 1])

output = model(x[0]) # Only first sample
> torch.Size([1])

Is this what you are looking for?

Yes, exactly, and I want to also know, for example, if I want to set the Import x=0.5, how should I write. Thank you very much.

problem solved, really thank you