MCPcopy
hub / github.com/tinygrad/tinygrad / from_buffer

Method from_buffer

tinygrad/uop/ops.py:713–715  ·  view source on GitHub ↗
(opaque:Buffer, device:str|tuple[str, ...]|None=None)

Source from the content-addressed store, hash-verified

711 return UOp(Ops.BUFFER, dtype, (UOp.unique(num), UOp(Ops.DEVICE, arg=device)), size)
712 @staticmethod
713 def from_buffer(opaque:Buffer, device:str|tuple[str, ...]|None=None):
714 buffers[uop:=UOp.new_buffer(device or opaque.device, opaque.size, opaque.dtype)] = opaque.ref(1)
715 return uop
716 @staticmethod
717 def empty(shape:tuple[sint, ...], dtype:DTypeLike|None=None, device:str|tuple[str, ...]|None=None, axis:int|None=None, num=None) -> UOp:
718 dtype, device = to_dtype(dtype) if dtype is not None else dtypes.default_float, canonicalize_device(device)

Callers 15

from_mvFunction · 0.80
mv_addressFunction · 0.80
optimize_local_sizeFunction · 0.80
__init__Method · 0.80
write_bufferFunction · 0.80
__init__Method · 0.80
read_tableMethod · 0.80
_ring_submitMethod · 0.80
__init__Method · 0.80
_run_discoveryMethod · 0.80
_time_programFunction · 0.80
_copyMethod · 0.80

Calls 2

new_bufferMethod · 0.80
refMethod · 0.45

Tested by 2

trace_cbFunction · 0.64
test_hevc_parserMethod · 0.64