Skip to content

switching_layer 层的参数恒为0,致使不能更新该层的参数 #1

Description

@gbl555

下面是我从/src/modules文件摘抄出来的代码
262行 self.switching_layer = nn.Linear(2 * hidden_size + hidden_size, 1) 282行 switch_prob = torch.ge(torch.sigmoid(self.switching_layer(switch_input)), 0.5).to(torch.float32) # [batch x 1 x 1] 303行 output = torch.where(~switch_prob.byte(), vocab_output, pointer_output)

因为vocab_output和pointer_output中都不含有self.switching_layer层的参数,所以,output 对switching_layer 层的参数求导结果为0,这样一来,switching_layer 层无法更新参数

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions