(self, inputs, mask=None, layer_cache=None, step=None)
return gating_outputs, average_outputs
Args:
            inputs (`FloatTensor`): `[batch_size x input_len x model_dim]`

        Returns:
            (`FloatTensor`, `FloatTensor`):

            * gating_outputs `[batch_size x 1 x model_dim]`
            * average_outputs average attention `[batch_size x 1 x model_dim]`
Args:
            inputs (`FloatTensor`): `[batch_size x input_len x model_dim]`
Args : inputs ( FloatTensor ) : [ batch_size x input_len x model_dim ]
def forward(self, inputs, mask=None, layer_cache=None, step=None):
        """
        Args:
            inputs (`FloatTensor`): `[batch_size x input_len x model_dim]`

        Returns:
            (`FloatTensor`, `FloatTensor`):

            * gating_outputs `[batch_size x 1 x model_dim]`
            * average_outputs average attention `[batch_size x 1 x model_dim]`
        """
        batch_size = inputs.size(0)
        inputs_len = inputs.size(1)

        device = inputs.device
        average_outputs = self.cumulative_average(
          inputs, self.cumulative_average_mask(batch_size,
                                               inputs_len).to(device).float()
          if layer_cache is None else step, layer_cache=layer_cache)
        average_outputs = self.average_layer(average_outputs)
        gating_outputs = self.gating_layer(torch.cat((inputs,
                                                      average_outputs), -1))
        input_gate, forget_gate = torch.chunk(gating_outputs, 2, dim=2)
        gating_outputs = torch.sigmoid(input_gate) * inputs + \
            torch.sigmoid(forget_gate) * average_outputs

        return gating_outputs, average_outputs
def forward ( self , inputs , mask = None , layer_cache = None , step = None ) : batch_size = inputs . size ( 0 ) inputs_len = inputs . size ( 1 ) device = inputs . device average_outputs = self . cumulative_average ( inputs , self . cumulative_average_mask ( batch_size , inputs_len ) . to ( device ) . float ( ) if layer_cache is None else step , layer_cache = layer_cache ) average_outputs = self . average_layer ( average_outputs ) gating_outputs = self . gating_layer ( torch . cat ( ( inputs , average_outputs ) , - 1 ) ) input_gate , forget_gate = torch . chunk ( gating_outputs , 2 , dim = 2 ) gating_outputs = torch . sigmoid ( input_gate ) * inputs + torch . sigmoid ( forget_gate ) * average_outputs return gating_outputs , average_outputs