Thank a lot! I think my code is a bit confusing. My code’s purpose is that when I input [1,100,100,1], it creates a DNN of which the structure is (linear(1,100), relu(), linear(100,100), relu(), linear(100,1)). (The example replace relu() with x**50). The net is adaptive. Therefore I use nn.Sequential.add_module().  Now I want to replace relu() with relu(x)*relu(1-x). I don’t know how to do it. I’m sorry I didn’t clarify the problem.