MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / forward

Method forward

examples/pytorch/decoder/utils/ft_decoder.py:134–143  ·  view source on GitHub ↗
(self, inputs, memory, memory_seq_lens, self_cache, mem_cache, sequence_lengths, step)

Source from the content-addressed store, hash-verified

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
146class ArgHelper(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected