MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / allocate_binding_buffer

Function allocate_binding_buffer

demo/HuggingFace/NNDF/tensorrt_utils.py:59–66  ·  view source on GitHub ↗

Allocate binding buffers for trt based on provided types and shapes dict

(types_dict, shapes_dict)

Source from the content-addressed store, hash-verified

57 return user_input
58
59def allocate_binding_buffer(types_dict, shapes_dict):
60 '''
61 Allocate binding buffers for trt based on provided types and shapes dict
62 '''
63 return {
64 k: torch.zeros(reduce(lambda v, a: v*a, shape), dtype=types_dict[k]).cuda()
65 for k, shape in shapes_dict.items()
66 }
67
68
69def set_kv_data(kv_dict, past_or_present, layer_id, segment_value_dict):

Callers 4

_allocate_memoryMethod · 0.90
_allocate_memoryMethod · 0.90
_allocate_memoryMethod · 0.90

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected