I’m sorry that I didn’t fully explain my mistake.
In fact, this error occurs even when you add act.cuda()
捕获1528×703 80.5 KB
I did another experiment, and the same error occurred：
class myNet(nn.Module):
    def __init__(self):
        super(myNet,self).__init__()
        act=Dynamic_relu_b()
        self.backbone=torch.nn.Sequential(
            
            act,
            
        )
    def forward(self,x):
        print(x.shape)
        x=self.backbone(x)
        return x
    
image=torch.rand((4,20,100,100))

image=image.cuda()
model=myNet()
model=model.cuda()
model(image)


The same mistake can happen！
I suspect it’s a problem inside the model, but I don’t know what the problem is