I want to use ReLU1 non-linear activation.  ReLU1 is linear in [0,1] but clamps values less than 0 to 0 and clamps values more than 1 to 1 .
So which of the following will be the best way to do, causing no problem in backpropagation.
x.clamp_(min=0.0, max=1.0) or torch.nn.functional.hardtanh_(x, min_val=0.0, max_val=1.0)
This will be just used for the final layer. For other layers I shall just use LeakyReLu.
Thankyou