(self, inputs, memory, memory_seq_lens, self_cache, mem_cache, sequence_lengths, step)
| 132 | self.dec_layer = torch.classes.FasterTransformerDecoder(*weights.w, head_num, head_size, head_num * head_size * 4, layer_num, mem_hidden_dim) |
| 133 | |
| 134 | def forward(self, inputs, memory, memory_seq_lens, self_cache, mem_cache, sequence_lengths, step): |
| 135 | dtype = torch.half if self.is_fp16 else torch.float32 |
| 136 | inputs_shape = inputs.shape |
| 137 | inputs = inputs.reshape([-1, inputs.shape[-1]]) |
| 138 | output, self_key_cache, self_val_cache, mem_key_cache, mem_val_cache = \ |
| 139 | self.dec_layer.forward(step, inputs, memory, memory_seq_lens, sequence_lengths, |
| 140 | self_cache[0], self_cache[1], mem_cache[0], mem_cache[1]) |
| 141 | output = output.reshape(inputs_shape) |
| 142 | |
| 143 | return output, [self_key_cache, self_val_cache], [mem_key_cache, mem_val_cache] |
| 144 | |
| 145 | |
| 146 | class ArgHelper(object): |
nothing calls this directly
no outgoing calls
no test coverage detected