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

Function get_ptr

bitsandbytes/functional.py:405–417  ·  view source on GitHub ↗

Gets the memory address of the first element of a tenso Args: A (`Optional[Tensor]`): A PyTorch tensor. Returns: `Optional[ct.c_void_p]`: A pointer to the underlying tensor data.

(A: Optional[Tensor])

Source from the content-addressed store, hash-verified

403
404
405def get_ptr(A: Optional[Tensor]) -> Optional[ct.c_void_p]:
406 """Gets the memory address of the first element of a tenso
407
408 Args:
409 A (`Optional[Tensor]`): A PyTorch tensor.
410
411 Returns:
412 `Optional[ct.c_void_p]`: A pointer to the underlying tensor data.
413 """
414 if A is None:
415 return None
416
417 return ct.c_void_p(A.data_ptr())
418
419
420class QuantState:

Callers 10

_dequantize_4bit_implFunction · 0.90
_gemv_4bit_implFunction · 0.90
_Function · 0.90
prefetch_tensorFunction · 0.85
elementwise_funcFunction · 0.85
igemmFunction · 0.85
batched_igemmFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected