python - 在这种情况下,Pytorch 如何处理反向传播?
问题描述
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
我有一些我想应用于我的网络的自定义蒙版(取决于图层)。根据上面的代码,Pytorch 是否考虑了反向传播过程中的掩码特征?我的意思是我的反向传播过程中的梯度会使用这些自定义掩码相乘吗?
解决方案
推荐阅读
- assembly - 是否非规范化 2 个浮点数的乘积
- python - How to implement user permission assignment module in Django template?
- heroku - In Heroku, is it possible to assign one env var to another env var?
- java - Is there a way to distinguish fat jar from thin jar?
- javascript - 如何在猫鼬模式中使用异步默认值?
- c - 函数声明问题,K&R问题1-15
- javascript - 检测 window.location.assign() 是否收到响应
- ios - iOS奇怪行为的通用链接
- tensorflow.js - 使用 Tensorflow.js 自定义模型访问标签和置信度值?
- c# - 按接口中定义的顺序对实现类方法进行排序