How can I change the slope of the sigmoid function?

Hi @songsong0425,

If you want to change the slope of the sigmoid function, you could just multiple the input to the sigmoid function by a scalar (or you just use a nn.Parameter if you want to vary the slope given a specific input).

slope = nn.Parameter(1)
probabilities = torch.sigmoid(slope * x)

You could also enforce that the slope is strictly positive via a nn.ReLU function as a negative slope will flip your probability values.

1 Like