MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / prefetch_tensor

Function prefetch_tensor

bitsandbytes/functional.py:102–109  ·  view source on GitHub ↗
(A: torch.Tensor, to_cpu=False)

Source from the content-addressed store, hash-verified

100
101
102def prefetch_tensor(A: torch.Tensor, to_cpu=False):
103 assert A.is_paged, "Only paged tensors can be prefetched!"
104 if to_cpu:
105 deviceid = -1
106 else:
107 deviceid = A.page_deviceid
108
109 lib.cprefetch(get_ptr(A), ct.c_size_t(A.nbytes), ct.c_int32(deviceid))
110
111
112def elementwise_func(func_name, A, B, value, prefetch=True):

Callers 2

prefetch_allMethod · 0.85
elementwise_funcFunction · 0.85

Calls 1

get_ptrFunction · 0.85

Tested by

no test coverage detected