class ExNet(nn.Module):
def __init__(self):
super(ExNet,self).__init__()
self.fc1 = nn.Linear(1024,500)
self.fc2 = nn.Linear(500,100)
self.fc3 = nn.Linear(100,10)
def forward(self,x,mask1, mask2):
x = F.relu(self.fc1(x))
x = x * mask
x = F.relu(self.fc2(x))
x = x * mask2
x = F.softmax(self.fc3(x),dim=1)
return x
我有一些自定义的遮罩(取决于图层),我想应用于我的网络。根据上面的代码,PyTrac在反向传播中考虑掩蔽特征吗?我的意思是,在反向传播过程中,我的梯度会使用这些自定义遮罩相乘吗
目前没有回答
相关问题 更多 >
编程相关推荐