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

Function init_onmt_cache

examples/pytorch/decoder/utils/decoder.py:48–55  ·  view source on GitHub ↗
(layer_num, memory_bank)

Source from the content-addressed store, hash-verified

46 return self_cache, mem_cache
47
48def init_onmt_cache(layer_num, memory_bank):
49 cache = {}
50 for i in range(layer_num):
51 layer_cache = {"memory_keys": None, "memory_values": None}
52 layer_cache["self_keys"] = None
53 layer_cache["self_values"] = None
54 cache[i] = layer_cache
55 return cache
56
57class ONMTDecoder(torch.nn.Module):
58 def __init__(self, layer_num, head_num, head_size, weights):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected